Dump class structure in a test that has an object in a lambda

This commit is contained in:
pyos
2020-03-19 13:41:38 +01:00
committed by max-kammerer
parent e0a5ab7146
commit d06c87207c
4 changed files with 52 additions and 3 deletions
@@ -859,7 +859,7 @@ class MethodInliner(
needReification: Boolean,
capturesAnonymousObjectThatMustBeRegenerated: Boolean
): AnonymousObjectTransformationInfo {
// In objects inside non-default lambdas, all reified type parameters are free (not from the function
// In objects inside non-default inline lambdas, all reified type parameters are free (not from the function
// we're inlining into) so there's nothing to reify:
//
// inline fun <reified T> f(x: () -> KClass<T> = { { T::class }() }) = x()
@@ -867,8 +867,8 @@ class MethodInliner(
// fun b() = f<Int> { { Int::class }() } // non-default lambda
// inline fun <reified V> c() = f<V> { { V::class }() }
//
// -- in a(), the default lambda captures T so a regeneration is needed; but in b() and c(), the non-default
// lambda cannot possibly reference it, while V is not yet bound so regenerating the object while inlining
// -- in a(), the default inline lambda captures T so a regeneration is needed; but in b() and c(), the non-default
// inline lambda cannot possibly reference it, while V is not yet bound so regenerating the object while inlining
// the lambda into f() is pointless.
val inNonDefaultLambda = inliningContext.isInliningLambda && inliningContext.lambdaInfo !is DefaultLambda
val info = AnonymousObjectTransformationInfo(
@@ -1,3 +1,4 @@
// CHECK_BYTECODE_LISTING
// FILE: 1.kt
package test
@@ -0,0 +1,24 @@
@kotlin.Metadata
public final class _2Kt$box$$inlined$complicatedCast$1 {
inner class _2Kt$box$$inlined$complicatedCast$1
public method <init>(): void
public final method f(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class _2Kt$complicatedCast$1$1 {
inner class _2Kt$complicatedCast$1$1
public method <init>(): void
public final method f(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class _2Kt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public synthetic final static method complicatedCast(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class test/_1Kt {
public final static method myRun(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
}
@@ -0,0 +1,24 @@
@kotlin.Metadata
public final class _2Kt$box$$inlined$complicatedCast$1 {
inner class _2Kt$box$$inlined$complicatedCast$1
public method <init>(): void
public final method f(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class _2Kt$complicatedCast$1$1 {
inner class _2Kt$complicatedCast$1$1
public method <init>(): void
public final method f(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class _2Kt {
public final static @org.jetbrains.annotations.NotNull method box(): java.lang.String
public synthetic final static method complicatedCast(@org.jetbrains.annotations.Nullable p0: java.lang.Object): java.lang.Object
}
@kotlin.Metadata
public final class test/_1Kt {
public final static method myRun(@org.jetbrains.annotations.NotNull p0: kotlin.jvm.functions.Function0): java.lang.Object
}