IC mangling: Use old mangling scheme when LV is 1.3
Add integration test to check, that nothing is broken with LV 1.3.
This commit is contained in:
+22
-1
@@ -18,7 +18,6 @@ import org.jetbrains.kotlin.cli.jvm.compiler.EnvironmentConfigFiles
|
||||
import org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment
|
||||
import org.jetbrains.kotlin.cli.metadata.K2MetadataCompiler
|
||||
import org.jetbrains.kotlin.codegen.forTestCompile.ForTestCompileRuntime
|
||||
import org.jetbrains.kotlin.codegen.inline.GENERATE_SMAP
|
||||
import org.jetbrains.kotlin.codegen.inline.remove
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.asSequence
|
||||
import org.jetbrains.kotlin.codegen.optimization.common.intConstant
|
||||
@@ -714,6 +713,28 @@ class CompileKotlinAgainstCustomBinariesTest : AbstractKotlinCompilerIntegration
|
||||
)
|
||||
}
|
||||
|
||||
fun testInlineClassesManglingAgainstLV13() {
|
||||
val library = compileLibrary(
|
||||
"library",
|
||||
additionalOptions = listOf("-language-version", "1.3", "-Xinline-classes"),
|
||||
checkKotlinOutput = {}
|
||||
)
|
||||
compileKotlin(
|
||||
"source.kt",
|
||||
tmpdir,
|
||||
listOf(library),
|
||||
additionalOptions = listOf("-XXLanguage:-MangleClassMembersReturningInlineClasses", "-Xinline-classes")
|
||||
)
|
||||
// Difference in mangling becomes apparent only on load time as NSME, so, to check the mangling we need to load the classfile
|
||||
loadClassFile("SourceKt", tmpdir, library)
|
||||
}
|
||||
|
||||
private fun loadClassFile(className: String, dir: File, library: File) {
|
||||
val classLoader = URLClassLoader(arrayOf(dir.toURI().toURL(), library.toURI().toURL()))
|
||||
val mainClass = classLoader.loadClass(className)
|
||||
mainClass.getDeclaredMethod("main", Array<String>::class.java).invoke(null, arrayOf<String>())
|
||||
}
|
||||
|
||||
companion object {
|
||||
// compiler before 1.1.4 version did not include suspension marks into bytecode.
|
||||
private fun stripSuspensionMarksToImitateLegacyCompiler(bytes: ByteArray): Pair<ByteArray, Int> {
|
||||
|
||||
@@ -209,11 +209,14 @@ abstract class AbstractVersionRequirementTest : TestCaseWithTmpdir() {
|
||||
fqNamesWithRequirements = listOf(
|
||||
"test.IC",
|
||||
"test.Ctor.<init>",
|
||||
"test.Foo",
|
||||
"test.Bar",
|
||||
"test.simpleFun",
|
||||
"test.aliasedFun",
|
||||
"test.simpleProp",
|
||||
"test.result",
|
||||
"test.simpleProp"
|
||||
)
|
||||
"test.Foo",
|
||||
"test.Bar"
|
||||
),
|
||||
shouldBeSingleRequirement = false
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user