From d17a18f96d2350d4ccea731f23215bd17622456a Mon Sep 17 00:00:00 2001 From: pyos Date: Thu, 23 Apr 2020 14:42:22 +0200 Subject: [PATCH] JVM: do not write trivial SMAPs to classes outside inline funs where trivial == those that map the file to itself. --- .../kotlin/codegen/ClosureCodegen.java | 3 +-- .../codegen/ImplementationBodyCodegen.java | 3 +-- .../kotlin/codegen/MemberCodegen.java | 18 +++++++++++++-- .../jetbrains/kotlin/codegen/inline/SMAP.kt | 3 +++ .../codegen/inline/inlineCodegenUtils.kt | 16 -------------- .../backend/jvm/codegen/ClassCodegen.kt | 4 +--- .../jvm/codegen/IrSourceCompilerForInline.kt | 2 +- .../codegen/boxInline/smap/assertion.kt | 11 ---------- .../codegen/boxInline/smap/crossroutines.kt | 11 ---------- .../codegen/boxInline/smap/defaultFunction.kt | 12 ---------- .../defaultLambda/defaultLambdaInAnonymous.kt | 11 ---------- .../smap/defaultLambda/inlinInDefault.kt | 11 ---------- .../smap/defaultLambda/inlinInDefault2.kt | 11 ---------- .../defaultLambda/inlineAnonymousInDefault.kt | 11 ---------- .../inlineAnonymousInDefault2.kt | 11 ---------- .../boxInline/smap/defaultLambda/kt21827.kt | 11 ---------- .../boxInline/smap/defaultLambda/nested.kt | 12 ---------- .../boxInline/smap/defaultLambda/simple.kt | 12 ---------- .../boxInline/smap/defaultLambda/simple2.kt | 11 ---------- .../boxInline/smap/inlineOnly/noSmap.kt | 11 ---------- .../smap/inlineOnly/noSmapWithProperty.kt | 11 ---------- .../smap/inlineOnly/stdlibInlineOnly.kt | 21 ++++++++++++++++++ .../inlineOnly/stdlibInlineOnlyOneLine.kt | 16 ++++++++++++++ .../BlackBoxInlineCodegenTestGenerated.java | 10 +++++++++ ...otlinAgainstInlineKotlinTestGenerated.java | 10 +++++++++ .../IrBlackBoxInlineCodegenTestGenerated.java | 10 +++++++++ ...otlinAgainstInlineKotlinTestGenerated.java | 10 +++++++++ .../CompileKotlinAgainstCustomBinariesTest.kt | 22 +------------------ .../IrJsCodegenInlineTestGenerated.java | 10 +++++++++ .../JsCodegenInlineTestGenerated.java | 10 +++++++++ 30 files changed, 121 insertions(+), 204 deletions(-) create mode 100644 compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt create mode 100644 compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java index 800255aef5d..7e2dd41992a 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ClosureCodegen.java @@ -54,7 +54,6 @@ import static org.jetbrains.kotlin.codegen.AsmUtil.*; import static org.jetbrains.kotlin.codegen.CallableReferenceUtilKt.*; import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.isConst; import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.CLOSURE; -import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.initDefaultSourceMappingIfNeeded; import static org.jetbrains.kotlin.codegen.serialization.JvmSerializationBindings.METHOD_FOR_FUNCTION; import static org.jetbrains.kotlin.resolve.jvm.AsmTypes.*; import static org.jetbrains.kotlin.resolve.jvm.diagnostics.JvmDeclarationOrigin.NO_ORIGIN; @@ -170,7 +169,7 @@ public class ClosureCodegen extends MemberCodegen { superInterfaceAsmTypes ); - initDefaultSourceMappingIfNeeded(context, this, state); + initDefaultSourceMappingIfNeeded(); v.visitSource(element.getContainingFile().getName(), null); } diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java index be3b1c1be03..7c20d679977 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/ImplementationBodyCodegen.java @@ -68,7 +68,6 @@ import static org.jetbrains.kotlin.codegen.CodegenUtilKt.isNonGenericToArray; import static org.jetbrains.kotlin.codegen.JvmCodegenUtil.*; import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.enumEntryNeedSubclass; import static org.jetbrains.kotlin.codegen.binding.CodegenBinding.getDelegatedLocalVariableMetadata; -import static org.jetbrains.kotlin.codegen.inline.InlineCodegenUtilsKt.initDefaultSourceMappingIfNeeded; import static org.jetbrains.kotlin.load.java.JvmAbi.*; import static org.jetbrains.kotlin.resolve.BindingContext.INDEXED_LVALUE_GET; import static org.jetbrains.kotlin.resolve.BindingContext.INDEXED_LVALUE_SET; @@ -228,7 +227,7 @@ public class ImplementationBodyCodegen extends ClassBodyCodegen { v.visitSource(myClass.getContainingKtFile().getName(), null); - initDefaultSourceMappingIfNeeded(context, this, state); + initDefaultSourceMappingIfNeeded(); writeEnclosingMethod(); diff --git a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java index 480e8d083e7..f7fc95bec09 100644 --- a/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java +++ b/compiler/backend/src/org/jetbrains/kotlin/codegen/MemberCodegen.java @@ -88,6 +88,7 @@ public abstract class MemberCodegen, codegen: MemberCodegen<*>, state: GenerationState -) { - if (state.isInlineDisabled) return - - var parentContext: CodegenContext<*>? = context.parentContext - while (parentContext != null) { - if (parentContext.isInlineMethodContext) { - //just init default one to one mapping - codegen.orCreateSourceMapper - break - } - parentContext = parentContext.parentContext - } -} - fun MethodNode.preprocessSuspendMarkers(forInline: Boolean, keepFakeContinuation: Boolean = true) { if (instructions.first == null) return if (!keepFakeContinuation) { 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 5ad5c671162..6f1701e1d3e 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 @@ -89,8 +89,6 @@ abstract class ClassCodegen protected constructor( ) } - internal var writeSourceMap: Boolean = withinInline - private var regeneratedObjectNameGenerators = mutableMapOf() fun getRegeneratedObjectNameGenerator(function: IrFunction): NameGenerator { @@ -145,7 +143,7 @@ abstract class ClassCodegen protected constructor( generateInnerAndOuterClasses() - if (writeSourceMap) { + if (withinInline || !smap.isTrivial) { visitor.visitSMAP(smap, !context.state.languageVersionSettings.supportsFeature(LanguageFeature.CorrectSourceMappingSyntax)) } else { visitor.visitSource(smap.sourceInfo!!.source, null) diff --git a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt index 00a819c9cd1..402951c059f 100644 --- a/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt +++ b/compiler/ir/backend.jvm/src/org/jetbrains/kotlin/backend/jvm/codegen/IrSourceCompilerForInline.kt @@ -86,7 +86,7 @@ class IrSourceCompilerForInline( } override val lazySourceMapper: SourceMapper - get() = codegen.smap.also { codegen.classCodegen.writeSourceMap = true } + get() = codegen.smap override fun generateLambdaBody(lambdaInfo: ExpressionLambda): SMAPAndMethodNode = FunctionCodegen((lambdaInfo as IrExpressionLambdaImpl).function, codegen.classCodegen, codegen).generate() diff --git a/compiler/testData/codegen/boxInline/smap/assertion.kt b/compiler/testData/codegen/boxInline/smap/assertion.kt index 0c681b914e8..1ea060dc8ee 100644 --- a/compiler/testData/codegen/boxInline/smap/assertion.kt +++ b/compiler/testData/codegen/boxInline/smap/assertion.kt @@ -37,17 +37,6 @@ fun box(): String { } // FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,26:1 -*E // FILE: 2.smap diff --git a/compiler/testData/codegen/boxInline/smap/crossroutines.kt b/compiler/testData/codegen/boxInline/smap/crossroutines.kt index cade4c8d63f..f4e570713e2 100644 --- a/compiler/testData/codegen/boxInline/smap/crossroutines.kt +++ b/compiler/testData/codegen/boxInline/smap/crossroutines.kt @@ -83,17 +83,6 @@ test/_1Kt$inlineMe1$2$run$1 *E // FILE: 2.smap -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt$builder$1 -*L -1#1,29:1 -*E - SMAP 2.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultFunction.kt b/compiler/testData/codegen/boxInline/smap/defaultFunction.kt index 453ce2687a2..b0a216e0368 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultFunction.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultFunction.kt @@ -15,18 +15,6 @@ fun box(): String { } // FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,9:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt index 4b0e9394dd4..92497a2de52 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/defaultLambdaInAnonymous.kt @@ -44,17 +44,6 @@ fun box(): String { } // FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,39:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault.kt index 26daf557393..ba999813acc 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault.kt @@ -46,17 +46,6 @@ fun box(): String { } // FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,39:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault2.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault2.kt index dd0d0e4fe5b..292de81ad16 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault2.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlinInDefault2.kt @@ -82,17 +82,6 @@ fun box(): String { } // FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,75:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt index b7058acf289..5f9c5c57a75 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault.kt @@ -45,17 +45,6 @@ fun box(): String { } // FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,40:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt index 18a5f8a734b..6aff50bbdbb 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/inlineAnonymousInDefault2.kt @@ -47,17 +47,6 @@ fun box(): String { } // FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,40:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/kt21827.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/kt21827.kt index 704d2e817bd..a8181437f6b 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/kt21827.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/kt21827.kt @@ -45,17 +45,6 @@ fun box(): String { } // FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,38:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt index e6fdda62385..59fd3929bde 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/nested.kt @@ -19,18 +19,6 @@ fun box(): String { } // FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,13:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/simple.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/simple.kt index 5251252824c..410ca97bc99 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/simple.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/simple.kt @@ -17,18 +17,6 @@ fun box(): String { } // FILE: 1.smap -//TODO maybe do smth with default method body mapping -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,11:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/defaultLambda/simple2.kt b/compiler/testData/codegen/boxInline/smap/defaultLambda/simple2.kt index 9566eb2541d..92516833845 100644 --- a/compiler/testData/codegen/boxInline/smap/defaultLambda/simple2.kt +++ b/compiler/testData/codegen/boxInline/smap/defaultLambda/simple2.kt @@ -43,17 +43,6 @@ fun box(): String { } // FILE: 1.smap -SMAP -1.kt -Kotlin -*S Kotlin -*F -+ 1 1.kt -test/_1Kt -*L -1#1,38:1 -*E - SMAP 1.kt Kotlin diff --git a/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmap.kt b/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmap.kt index 2657f37b0d1..a8668f4f105 100644 --- a/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmap.kt +++ b/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmap.kt @@ -13,14 +13,3 @@ fun box(): String { } // FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -*L -1#1,7:1 -*E diff --git a/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt b/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt index d3f2d9bf1f4..16a2e6e5eb7 100644 --- a/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt +++ b/compiler/testData/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt @@ -18,14 +18,3 @@ fun box(): String { } // FILE: 2.smap - -SMAP -2.kt -Kotlin -*S Kotlin -*F -+ 1 2.kt -_2Kt -*L -1#1,8:1 -*E diff --git a/compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt b/compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt new file mode 100644 index 00000000000..64c53bd8bb0 --- /dev/null +++ b/compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt @@ -0,0 +1,21 @@ +// FILE: 1.kt +package test + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@kotlin.internal.InlineOnly +inline fun T.myLet(block: (T) -> R) = block(this) + +// FILE: 2.kt +import test.* + +fun box(): String { + // should not have any line numbers + val k = "".myLet { + it + "K" + } + return "O".myLet(fun (it: String): String { + return it + k + }) +} + +// FILE: 2.smap diff --git a/compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt b/compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt new file mode 100644 index 00000000000..b6af5b5c9f7 --- /dev/null +++ b/compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt @@ -0,0 +1,16 @@ +// FILE: 1.kt +package test + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +@kotlin.internal.InlineOnly +inline fun T.myLet(block: (T) -> R) = block(this) + +// FILE: 2.kt +import test.* + +fun box(): String { + val k = "".myLet { it + "K" } + return "O".myLet(fun (it: String): String { return it + k }) +} + +// FILE: 2.smap diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java index 6729abad028..2a3bcd08c89 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/BlackBoxInlineCodegenTestGenerated.java @@ -3522,6 +3522,16 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo public void testReifiedProperty() throws Exception { runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt"); } + + @TestMetadata("stdlibInlineOnly.kt") + public void testStdlibInlineOnly() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt"); + } + + @TestMetadata("stdlibInlineOnlyOneLine.kt") + public void testStdlibInlineOnlyOneLine() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt"); + } } @TestMetadata("compiler/testData/codegen/boxInline/smap/newsmap") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java index 6ddac88bc66..f4619e0d1bd 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/CompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3522,6 +3522,16 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi public void testReifiedProperty() throws Exception { runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt"); } + + @TestMetadata("stdlibInlineOnly.kt") + public void testStdlibInlineOnly() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt"); + } + + @TestMetadata("stdlibInlineOnlyOneLine.kt") + public void testStdlibInlineOnlyOneLine() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt"); + } } @TestMetadata("compiler/testData/codegen/boxInline/smap/newsmap") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java index 91a32638601..85fc0589eeb 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrBlackBoxInlineCodegenTestGenerated.java @@ -3522,6 +3522,16 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli public void testReifiedProperty() throws Exception { runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt"); } + + @TestMetadata("stdlibInlineOnly.kt") + public void testStdlibInlineOnly() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt"); + } + + @TestMetadata("stdlibInlineOnlyOneLine.kt") + public void testStdlibInlineOnlyOneLine() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt"); + } } @TestMetadata("compiler/testData/codegen/boxInline/smap/newsmap") diff --git a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java index aebc49ae521..bfe4315af94 100644 --- a/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java +++ b/compiler/tests/org/jetbrains/kotlin/codegen/ir/IrCompileKotlinAgainstInlineKotlinTestGenerated.java @@ -3522,6 +3522,16 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC public void testReifiedProperty() throws Exception { runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/reifiedProperty.kt"); } + + @TestMetadata("stdlibInlineOnly.kt") + public void testStdlibInlineOnly() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt"); + } + + @TestMetadata("stdlibInlineOnlyOneLine.kt") + public void testStdlibInlineOnlyOneLine() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt"); + } } @TestMetadata("compiler/testData/codegen/boxInline/smap/newsmap") diff --git a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt index 52520db4646..d7ff4bef85c 100644 --- a/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt +++ b/compiler/tests/org/jetbrains/kotlin/jvm/compiler/CompileKotlinAgainstCustomBinariesTest.kt @@ -438,32 +438,12 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration compileKotlin("source.kt", tmpdir, listOf(tmpdir)) - var debugInfo: String? = null val resultFile = File(tmpdir.absolutePath, "test/B.class") ClassReader(resultFile.readBytes()).accept(object : ClassVisitor(Opcodes.API_VERSION) { override fun visitSource(source: String?, debug: String?) { - debugInfo = debug + assertEquals(null, debug) } }, 0) - - val expected = """ - SMAP - source.kt - Kotlin - *S Kotlin - *F - + 1 source.kt - test/B - *L - 1#1,13:1 - *E - """.trimIndent() + "\n" - - if (GENERATE_SMAP) { - assertEquals(expected, debugInfo) - } else { - assertEquals(null, debugInfo) - } } /* Regression test for KT-37107: compile against .class file without any constructors. */ diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java index 50be5b8a4b0..ea162f23572 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/ir/semantics/IrJsCodegenInlineTestGenerated.java @@ -3122,6 +3122,16 @@ public class IrJsCodegenInlineTestGenerated extends AbstractIrJsCodegenInlineTes public void testNoSmapWithProperty() throws Exception { runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt"); } + + @TestMetadata("stdlibInlineOnly.kt") + public void testStdlibInlineOnly() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt"); + } + + @TestMetadata("stdlibInlineOnlyOneLine.kt") + public void testStdlibInlineOnlyOneLine() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt"); + } } @TestMetadata("compiler/testData/codegen/boxInline/smap/newsmap") diff --git a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java index d810b6b2278..57bee3101e7 100644 --- a/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java +++ b/js/js.tests/test/org/jetbrains/kotlin/js/test/semantics/JsCodegenInlineTestGenerated.java @@ -3122,6 +3122,16 @@ public class JsCodegenInlineTestGenerated extends AbstractJsCodegenInlineTest { public void testNoSmapWithProperty() throws Exception { runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/noSmapWithProperty.kt"); } + + @TestMetadata("stdlibInlineOnly.kt") + public void testStdlibInlineOnly() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnly.kt"); + } + + @TestMetadata("stdlibInlineOnlyOneLine.kt") + public void testStdlibInlineOnlyOneLine() throws Exception { + runTest("compiler/testData/codegen/boxInline/smap/inlineOnly/stdlibInlineOnlyOneLine.kt"); + } } @TestMetadata("compiler/testData/codegen/boxInline/smap/newsmap")