diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt index ffe298dd5ba..edcfb1dfed4 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ClassCodegen.kt @@ -41,7 +41,8 @@ import java.io.File open class ClassCodegen protected constructor( internal val irClass: IrClass, val context: JvmBackendContext, - private val parentClassCodegen: ClassCodegen? = null + private val parentClassCodegen: ClassCodegen? = null, + private val withinInline: Boolean = false ) : InnerClassConsumer { private val innerClasses = mutableListOf() @@ -74,6 +75,9 @@ open class ClassCodegen protected constructor( } fun generate(): ReifiedTypeParametersUsages { + if (withinInline) { + getOrCreateSourceMapper() //initialize default mapping that would be later written in class file + } val superClassInfo = irClass.getSuperClassInfo(typeMapper) val signature = getSignature(irClass, type, superClassInfo, typeMapper) @@ -232,8 +236,8 @@ open class ClassCodegen protected constructor( } } - fun generateLocalClass(klass: IrClass): ReifiedTypeParametersUsages { - return ClassCodegen(klass, context, this).generate() + fun generateLocalClass(klass: IrClass, withinInline: Boolean): ReifiedTypeParametersUsages { + return ClassCodegen(klass, context, this, withinInline = withinInline || this.withinInline).generate() } private fun generateField(field: IrField) { diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt index ef4301876e8..203fd423d67 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/ExpressionCodegen.kt @@ -576,9 +576,8 @@ class ExpressionCodegen( "is not implemented, or it should have been lowered: ${element.render()}" ) - // TODO maybe remove? override fun visitClass(declaration: IrClass, data: BlockInfo): PromisedValue { - classCodegen.generateLocalClass(declaration).also { + classCodegen.generateLocalClass(declaration, irFunction.isInline).also { closureReifiedMarkers[declaration] = it } return immaterialUnitValue diff --git a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/kt17384.kt b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/kt17384.kt index 97dabd308f4..21aa85b6baa 100644 --- a/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/kt17384.kt +++ b/compiler/testData/codegen/box/controlStructures/breakContinueInExpressions/kt17384.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR fun returnNullable(): String? = null inline fun Array.matchAll(fn: (String) -> Unit) { diff --git a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt index 878d4ec5ce0..c8ad1f3620a 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/capturedLambdaInInline3.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt index ffac7cf12d5..1e8e1ab579c 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt14011.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/kt14011_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/kt14011_2.kt index d727916bc9c..3997d2aa02f 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/kt14011_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/kt14011_2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt b/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt index 59b1667754a..761baaab332 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/safeCall.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt b/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt index f25423d1586..ed67f8175f0 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/safeCall_2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt index d6a2e225118..09b3e310e04 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/sam/kt17091.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt // FULL_JDK diff --git a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt index be68d2a0e57..6aabb90b5b5 100644 --- a/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt +++ b/compiler/testData/codegen/boxInline/anonymousObject/twoCapturedReceivers/kt8668.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda.kt b/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda.kt index 8d0fb45daf8..580a9e8626f 100644 --- a/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda.kt +++ b/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // FILE: inline.kt // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm diff --git a/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda2.kt b/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda2.kt index 788907104c2..ad6b24bb068 100644 --- a/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda2.kt +++ b/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambda2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // FILE: inline.kt // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm diff --git a/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambdaDeclarationSite.kt b/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambdaDeclarationSite.kt index 153786f25fd..8007d87d8fe 100644 --- a/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambdaDeclarationSite.kt +++ b/compiler/testData/codegen/boxInline/assert/jvmCrossinlineLambdaDeclarationSite.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // TARGET_BACKEND: JVM // FILE: inline.kt // KOTLIN_CONFIGURATION_FLAGS: ASSERTIONS_MODE=jvm diff --git a/compiler/testData/codegen/boxInline/complex/with.kt b/compiler/testData/codegen/boxInline/complex/with.kt index 4946acd3978..54e147cfeeb 100644 --- a/compiler/testData/codegen/boxInline/complex/with.kt +++ b/compiler/testData/codegen/boxInline/complex/with.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt // WITH_RUNTIME package test diff --git a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt index 62d2a439bb0..458a717c608 100644 --- a/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt +++ b/compiler/testData/codegen/boxInline/defaultValues/lambdaInlining/receiverClash2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt // SKIP_INLINE_CHECK_IN: inlineFun$default package test diff --git a/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt b/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt index 5f4ffbd2166..6b77f48e346 100644 --- a/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt +++ b/compiler/testData/codegen/boxInline/lambdaClassClash/lambdaClassClash.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package zzz diff --git a/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt b/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt index c86e57b2901..86aab34cb6d 100644 --- a/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt +++ b/compiler/testData/codegen/boxInline/lambdaTransformation/lambdaInLambdaNoInline.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/simple/rootConstructor.kt b/compiler/testData/codegen/boxInline/simple/rootConstructor.kt index ac23d17dcc4..1af43ae7c06 100644 --- a/compiler/testData/codegen/boxInline/simple/rootConstructor.kt +++ b/compiler/testData/codegen/boxInline/simple/rootConstructor.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt package test diff --git a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt index 292648c9416..3f82fde796e 100644 --- a/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt +++ b/compiler/testData/codegen/boxInline/smap/anonymous/lambda.kt @@ -1,5 +1,5 @@ // FILE: 1.kt -// IGNORE_BACKEND: JVM_IR + package builders inline fun call(crossinline init: () -> Unit) { diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt index 9d2019ae554..92b0c860b62 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt @@ -1,6 +1,6 @@ // FILE: 1.kt // SKIP_INLINE_CHECK_IN: lParams$default -// IGNORE_BACKEND: JVM_IR + package test //A lot of blank lines [Don't delete] //A lot of blank lines [Don't delete] diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt index d01a4f97393..1c37d2e0ba6 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt @@ -1,6 +1,6 @@ // FILE: 1.kt // SKIP_INLINE_CHECK_IN: lParams$default -// IGNORE_BACKEND: JVM_IR + package test //A lot of blank lines [Don't delete] //A lot of blank lines [Don't delete] diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt index 4018d688d1a..2ade534854f 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt @@ -1,6 +1,6 @@ // FILE: 1.kt // SKIP_INLINE_CHECK_IN: lParams$default -// IGNORE_BACKEND: JVM_IR + package test //A lot of blank lines [Don't delete] //A lot of blank lines [Don't delete] diff --git a/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt b/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt index 32aa91fb926..9e0289e38d0 100644 --- a/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt +++ b/compiler/testData/codegen/boxInline/special/loopInStoreLoadChains2.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR // FILE: 1.kt inline fun cycle(p: String): String { var z = p diff --git a/compiler/testData/writeFlags/inline/lostInnerClass3.kt b/compiler/testData/writeFlags/inline/lostInnerClass3.kt index a2c98cbb75c..d3909a59c2d 100644 --- a/compiler/testData/writeFlags/inline/lostInnerClass3.kt +++ b/compiler/testData/writeFlags/inline/lostInnerClass3.kt @@ -1,4 +1,3 @@ -// IGNORE_BACKEND: JVM_IR interface Introspector { fun test() { class SchemaRetriever(val transaction: String) {