Add jvm-abi-gen test on inline class with private ctor
KT-54897
This commit is contained in:
committed by
Space Team
parent
89ba1b515e
commit
beb3759f5a
@@ -67,7 +67,7 @@ abstract class BaseJvmAbiTest : TestCase() {
|
||||
dep.abiDir
|
||||
}
|
||||
|
||||
val directives = if (compilation.directives.exists()) compilation.directives.readText() else null
|
||||
val directives = if (compilation.directives.exists()) compilation.directives.readText() else ""
|
||||
|
||||
val messageCollector = LocationReportingTestMessageCollector()
|
||||
val compiler = K2JVMCompiler()
|
||||
@@ -80,8 +80,8 @@ abstract class BaseJvmAbiTest : TestCase() {
|
||||
if (useLegacyAbiGen) abiOption("useLegacyAbiGen", "true") else null
|
||||
).toTypedArray()
|
||||
destination = compilation.destinationDir.canonicalPath
|
||||
noSourceDebugExtension =
|
||||
directives != null && InTextDirectivesUtils.findStringWithPrefixes(directives, "// NO_SOURCE_DEBUG_EXTENSION") != null
|
||||
noSourceDebugExtension = InTextDirectivesUtils.findStringWithPrefixes(directives, "// NO_SOURCE_DEBUG_EXTENSION") != null
|
||||
useK2 = InTextDirectivesUtils.findStringWithPrefixes(directives, "// USE_K2") != null
|
||||
}
|
||||
val exitCode = compiler.exec(messageCollector, Services.EMPTY, args)
|
||||
if (exitCode != ExitCode.OK || messageCollector.errors.isNotEmpty()) {
|
||||
|
||||
Generated
+10
@@ -60,6 +60,16 @@ public class CompileAgainstJvmAbiTestGenerated extends AbstractCompileAgainstJvm
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineCapture/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassWithPrivateConstructor")
|
||||
public void testInlineClassWithPrivateConstructor() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineClassWithPrivateConstructor/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassWithPrivateConstructorK2")
|
||||
public void testInlineClassWithPrivateConstructorK2() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineClassWithPrivateConstructorK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineNoRegeneration")
|
||||
public void testInlineNoRegeneration() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineNoRegeneration/");
|
||||
|
||||
Generated
+10
@@ -60,6 +60,16 @@ public class LegacyCompileAgainstJvmAbiTestGenerated extends AbstractLegacyCompi
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineCapture/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassWithPrivateConstructor")
|
||||
public void testInlineClassWithPrivateConstructor() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineClassWithPrivateConstructor/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineClassWithPrivateConstructorK2")
|
||||
public void testInlineClassWithPrivateConstructorK2() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineClassWithPrivateConstructorK2/");
|
||||
}
|
||||
|
||||
@TestMetadata("inlineNoRegeneration")
|
||||
public void testInlineNoRegeneration() throws Exception {
|
||||
runTest("plugins/jvm-abi-gen/testData/compile/inlineNoRegeneration/");
|
||||
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package app
|
||||
|
||||
import lib.*
|
||||
|
||||
fun runAppAndReturnOk(): String =
|
||||
IC.of("OK").value
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package lib
|
||||
|
||||
@JvmInline
|
||||
value class IC private constructor(val value: String) {
|
||||
companion object {
|
||||
fun of(value: String) = IC(value)
|
||||
}
|
||||
}
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
package app
|
||||
|
||||
import lib.*
|
||||
|
||||
fun runAppAndReturnOk(): String =
|
||||
IC.of("OK").value
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
// USE_K2
|
||||
// IGNORE_BACKEND_LEGACY: JVM_IR
|
||||
+8
@@ -0,0 +1,8 @@
|
||||
package lib
|
||||
|
||||
@JvmInline
|
||||
value class IC private constructor(val value: String) {
|
||||
companion object {
|
||||
fun of(value: String) = IC(value)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user