[Tests] Replace @JvmInline with actual OPTIONAL_JVM_INLINE_ANNOTATION
This commit is contained in:
+3
-3
@@ -19291,13 +19291,13 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
@Test
|
@Test
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", "@kotlin.jvm.JvmInline"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCallWithoutJvmInlineAnnotation() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("@(kotlin.jvm.)?JvmInline", ""));
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
@@ -26,8 +26,8 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
|
|||||||
|
|
||||||
fun runTest(
|
fun runTest(
|
||||||
@TestDataFile testDataFileName: String,
|
@TestDataFile testDataFileName: String,
|
||||||
|
expectedFileTransformer: ((String) -> String)? = null,
|
||||||
beforeDispose: (TestConfiguration) -> Unit = {},
|
beforeDispose: (TestConfiguration) -> Unit = {},
|
||||||
expectedFileTransformer: ((String) -> String)? = null
|
|
||||||
) {
|
) {
|
||||||
try {
|
try {
|
||||||
runTestImpl(testDataFileName, expectedFileTransformer)
|
runTestImpl(testDataFileName, expectedFileTransformer)
|
||||||
|
|||||||
+2
-3
@@ -1,9 +1,8 @@
|
|||||||
// WITH_STDLIB
|
// WITH_STDLIB
|
||||||
// WORKS_WITHOUT_JVM_INLINE
|
// WORKS_WHEN_VALUE_CLASS
|
||||||
// !LANGUAGE: +ValueClasses
|
// !LANGUAGE: +ValueClasses
|
||||||
|
|
||||||
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
|
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||||
@kotlin.jvm.JvmInline
|
|
||||||
value class Result<T>(val a: Any?)
|
value class Result<T>(val a: Any?)
|
||||||
|
|
||||||
fun box(): String {
|
fun box(): String {
|
||||||
|
|||||||
+3
-3
@@ -19291,13 +19291,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
@Test
|
@Test
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt");
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", "@kotlin.jvm.JvmInline"));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||||
public void testBoxResultInlineClassOfConstructorCallWithoutJvmInlineAnnotation() throws Exception {
|
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("@(kotlin.jvm.)?JvmInline", ""));
|
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", ""));
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
|
|||||||
+2
-1
@@ -24,7 +24,8 @@ object WithoutJvmInlineTestMethodGenerator : MethodGenerator<WithoutJvmInlineTes
|
|||||||
override fun generateBody(method: WithoutJvmInlineTestMethodModel, p: Printer) {
|
override fun generateBody(method: WithoutJvmInlineTestMethodModel, p: Printer) {
|
||||||
with(method) {
|
with(method) {
|
||||||
val filePath = KtTestUtil.getFilePath(source.file) + if (source.file.isDirectory) "/" else ""
|
val filePath = KtTestUtil.getFilePath(source.file) + if (source.file.isDirectory) "/" else ""
|
||||||
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\", s -> s.replaceAll(\"@(kotlin.jvm.)?JvmInline\", \"\"));")
|
val replacement = if (method.withAnnotation) "@kotlin.jvm.JvmInline" else ""
|
||||||
|
p.println("${RunTestMethodModel.METHOD_NAME}(\"$filePath\", s -> s.replaceAll(\"OPTIONAL_JVM_INLINE_ANNOTATION\", \"$replacement\"));")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+3
-2
@@ -6,14 +6,15 @@
|
|||||||
package org.jetbrains.kotlin.generators.model
|
package org.jetbrains.kotlin.generators.model
|
||||||
|
|
||||||
class WithoutJvmInlineTestMethodModel(
|
class WithoutJvmInlineTestMethodModel(
|
||||||
val source: SimpleTestMethodModel
|
val source: SimpleTestMethodModel,
|
||||||
|
val withAnnotation: Boolean
|
||||||
) : MethodModel {
|
) : MethodModel {
|
||||||
object Kind : MethodModel.Kind()
|
object Kind : MethodModel.Kind()
|
||||||
|
|
||||||
override val kind: MethodModel.Kind
|
override val kind: MethodModel.Kind
|
||||||
get() = Kind
|
get() = Kind
|
||||||
override val name: String
|
override val name: String
|
||||||
get() = "${source.name}WithoutJvmInlineAnnotation"
|
get() = source.name + if (withAnnotation) "" else "_valueClasses"
|
||||||
override val dataString: String
|
override val dataString: String
|
||||||
get() = source.dataString
|
get() = source.dataString
|
||||||
override val tags: List<String>
|
override val tags: List<String>
|
||||||
|
|||||||
+3
-2
@@ -12,7 +12,7 @@ import java.util.regex.Pattern
|
|||||||
|
|
||||||
fun TestEntityModel.containsWithoutJvmInline(backend: TargetBackend): Boolean = backend == TargetBackend.JVM_IR && when (this) {
|
fun TestEntityModel.containsWithoutJvmInline(backend: TargetBackend): Boolean = backend == TargetBackend.JVM_IR && when (this) {
|
||||||
is ClassModel -> methods.any { it.containsWithoutJvmInline(backend) } || innerTestClasses.any { it.containsWithoutJvmInline(backend) }
|
is ClassModel -> methods.any { it.containsWithoutJvmInline(backend) } || innerTestClasses.any { it.containsWithoutJvmInline(backend) }
|
||||||
is SimpleTestMethodModel -> file.readLines().any { Regex("^\\s*//\\s*WORKS_WITHOUT_JVM_INLINE\\s*$").matches(it) }
|
is SimpleTestMethodModel -> file.readLines().any { Regex("^\\s*//\\s*WORKS_WHEN_VALUE_CLASS\\s*$").matches(it) }
|
||||||
else -> false
|
else -> false
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -33,5 +33,6 @@ fun methodModelLocator(
|
|||||||
skipIgnored,
|
skipIgnored,
|
||||||
tags
|
tags
|
||||||
).let { methodModel ->
|
).let { methodModel ->
|
||||||
listOf(methodModel) + if (methodModel.containsWithoutJvmInline(targetBackend)) listOf(WithoutJvmInlineTestMethodModel(methodModel)) else emptyList()
|
if (methodModel.containsWithoutJvmInline(targetBackend)) listOf(true, false).map { WithoutJvmInlineTestMethodModel(methodModel, it) }
|
||||||
|
else listOf(methodModel)
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user