Files
kotlin/compiler/testData/codegen/bytecodeListing/localFunctions/genericLocalClass.kt
Alexander Udalov c14a890e7e IR: fix capturing of type parameters in local functions
collectPotentiallyCapturedTypeParameters no longer stops on the first
class when going through parents. This is needed because otherwise type
parameters of the containing class, and its outer classes, were never
considered "captured", and thus not duplicated/remapped later in
LocalDeclarationsLowering.

This led to the IR where a local function referenced generic type
parameters of the outer class. On JVM, local function is generated into
a private static function in that container class, and static functions
can't use generic type parameters, which crashed some bytecode
processing tools.

Also, add another explicit call to `seeType` to cover references to
generic type parameters in function return types.

 #KT-45941 Fixed
2021-05-04 21:10:56 +02:00

12 lines
176 B
Kotlin
Vendored

// WITH_SIGNATURES
class A<T>(val result: T) {
fun b() {
class C<S> {
fun f() {
fun g(t: T): S? = null
}
}
}
}