JVM: do not write trivial SMAPs to classes outside inline funs

where trivial == those that map the file to itself.
This commit is contained in:
pyos
2020-04-23 14:42:22 +02:00
committed by max-kammerer
parent a04aeeb4e1
commit d17a18f96d
30 changed files with 121 additions and 204 deletions
@@ -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")
@@ -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")
@@ -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")
@@ -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")
@@ -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. */