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(