[JVM] Forbid non-JvmInline value classes again

This commit is contained in:
Evgeniy.Zhelenskiy
2021-12-25 04:44:00 +03:00
committed by Space
parent 7595f798e1
commit df1de3a7d3
19 changed files with 126 additions and 4798 deletions
@@ -7,12 +7,16 @@ package org.jetbrains.kotlin.generators.model
class WithoutJvmInlineTestMethodModel(
source: SimpleTestMethodModel,
withAnnotation: Boolean,
withAnnotation: Boolean?,
withPostfix: Boolean,
) : TransformingTestMethodModel(
source,
transformer = "TransformersFunctions.get" +
if (withAnnotation) "ReplaceOptionalJvmInlineAnnotationWithReal()" else "RemoveOptionalJvmInlineAnnotation()"
when (withAnnotation) {
true -> "ReplaceOptionalJvmInlineAnnotationWithReal()"
false -> "RemoveOptionalJvmInlineAnnotation()"
null -> "ReplaceOptionalJvmInlineAnnotationWithUniversal()"
}
) {
override val name: String = source.name + if (withPostfix) "_valueClasses" else ""
}
@@ -42,9 +42,9 @@ fun methodModelLocator(
).let { methodModel ->
if (methodModel.containsWithoutJvmInline()) {
val isWithAnnotationAndIsWithPostfix = when {
!targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM) -> listOf(false to false)
targetBackend.isIR -> listOf(true to false, false to true)
else -> listOf(true to false)
targetBackend.isRecursivelyCompatibleWith(TargetBackend.JVM) -> listOf(true to false)
targetBackend == TargetBackend.ANY -> listOf(null to false)
else -> listOf(false to false)
}
isWithAnnotationAndIsWithPostfix.map { (ann, post) -> WithoutJvmInlineTestMethodModel(methodModel, ann, post) }
} else listOf(methodModel)