[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
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
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
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCallWithoutJvmInlineAnnotation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("@(kotlin.jvm.)?JvmInline", ""));
|
||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
@@ -26,8 +26,8 @@ class TestRunner(private val testConfiguration: TestConfiguration) {
|
||||
|
||||
fun runTest(
|
||||
@TestDataFile testDataFileName: String,
|
||||
expectedFileTransformer: ((String) -> String)? = null,
|
||||
beforeDispose: (TestConfiguration) -> Unit = {},
|
||||
expectedFileTransformer: ((String) -> String)? = null
|
||||
) {
|
||||
try {
|
||||
runTestImpl(testDataFileName, expectedFileTransformer)
|
||||
|
||||
+2
-3
@@ -1,9 +1,8 @@
|
||||
// WITH_STDLIB
|
||||
// WORKS_WITHOUT_JVM_INLINE
|
||||
// WORKS_WHEN_VALUE_CLASS
|
||||
// !LANGUAGE: +ValueClasses
|
||||
|
||||
@Suppress("OPTIONAL_DECLARATION_USAGE_IN_NON_COMMON_SOURCE")
|
||||
@kotlin.jvm.JvmInline
|
||||
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||
value class Result<T>(val a: Any?)
|
||||
|
||||
fun box(): String {
|
||||
|
||||
+3
-3
@@ -19291,13 +19291,13 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
||||
@Test
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
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
|
||||
@TestMetadata("boxResultInlineClassOfConstructorCall.kt")
|
||||
public void testBoxResultInlineClassOfConstructorCallWithoutJvmInlineAnnotation() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("@(kotlin.jvm.)?JvmInline", ""));
|
||||
public void testBoxResultInlineClassOfConstructorCall_valueClasses() throws Exception {
|
||||
runTest("compiler/testData/codegen/box/inlineClasses/boxResultInlineClassOfConstructorCall.kt", s -> s.replaceAll("OPTIONAL_JVM_INLINE_ANNOTATION", ""));
|
||||
}
|
||||
|
||||
@Test
|
||||
|
||||
+2
-1
@@ -24,7 +24,8 @@ object WithoutJvmInlineTestMethodGenerator : MethodGenerator<WithoutJvmInlineTes
|
||||
override fun generateBody(method: WithoutJvmInlineTestMethodModel, p: Printer) {
|
||||
with(method) {
|
||||
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
|
||||
|
||||
class WithoutJvmInlineTestMethodModel(
|
||||
val source: SimpleTestMethodModel
|
||||
val source: SimpleTestMethodModel,
|
||||
val withAnnotation: Boolean
|
||||
) : MethodModel {
|
||||
object Kind : MethodModel.Kind()
|
||||
|
||||
override val kind: MethodModel.Kind
|
||||
get() = Kind
|
||||
override val name: String
|
||||
get() = "${source.name}WithoutJvmInlineAnnotation"
|
||||
get() = source.name + if (withAnnotation) "" else "_valueClasses"
|
||||
override val dataString: String
|
||||
get() = source.dataString
|
||||
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) {
|
||||
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
|
||||
}
|
||||
|
||||
@@ -33,5 +33,6 @@ fun methodModelLocator(
|
||||
skipIgnored,
|
||||
tags
|
||||
).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