FIR: fix Clonable detection condition in inline checker
This commit is contained in:
+1
-2
@@ -38,7 +38,6 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() {
|
|||||||
private val javaLangFqName = FqName("java.lang")
|
private val javaLangFqName = FqName("java.lang")
|
||||||
private val cloneableFqName = FqName("Cloneable")
|
private val cloneableFqName = FqName("Cloneable")
|
||||||
|
|
||||||
@Suppress("NAME_SHADOWING")
|
|
||||||
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
override fun check(declaration: FirRegularClass, context: CheckerContext, reporter: DiagnosticReporter) {
|
||||||
if (!declaration.symbol.isInlineOrValueClass()) {
|
if (!declaration.symbol.isInlineOrValueClass()) {
|
||||||
return
|
return
|
||||||
@@ -274,5 +273,5 @@ object FirInlineClassDeclarationChecker : FirRegularClassChecker() {
|
|||||||
|
|
||||||
private fun ClassId.isCloneableId(): Boolean =
|
private fun ClassId.isCloneableId(): Boolean =
|
||||||
relativeClassName == cloneableFqName &&
|
relativeClassName == cloneableFqName &&
|
||||||
packageFqName == StandardClassIds.BASE_KOTLIN_PACKAGE || packageFqName == javaLangFqName
|
(packageFqName == StandardClassIds.BASE_KOTLIN_PACKAGE || packageFqName == javaLangFqName)
|
||||||
}
|
}
|
||||||
|
|||||||
+6
@@ -21515,6 +21515,12 @@ public class FirBlackBoxCodegenTestGenerated extends AbstractFirBlackBoxCodegenT
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inlineClassImplementsJavaLangInterface.kt")
|
||||||
|
public void testInlineClassImplementsJavaLangInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsJavaLangInterface.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineClassInInitBlock.kt")
|
@TestMetadata("inlineClassInInitBlock.kt")
|
||||||
public void testInlineClassInInitBlock() throws Exception {
|
public void testInlineClassInInitBlock() throws Exception {
|
||||||
|
|||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
// TARGET_BACKEND: JVM
|
||||||
|
// FULL_JDK
|
||||||
|
// WITH_STDLIB
|
||||||
|
// WORKS_WHEN_VALUE_CLASS
|
||||||
|
// LANGUAGE: +ValueClasses
|
||||||
|
|
||||||
|
OPTIONAL_JVM_INLINE_ANNOTATION
|
||||||
|
value class InlineRunnable(val block: () -> Unit) : Runnable {
|
||||||
|
override fun run() = block()
|
||||||
|
}
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var result = "fail"
|
||||||
|
(InlineRunnable { result = "OK" } as Runnable).run()
|
||||||
|
return result
|
||||||
|
}
|
||||||
+6
@@ -20765,6 +20765,12 @@ public class BlackBoxCodegenTestGenerated extends AbstractBlackBoxCodegenTest {
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inlineClassImplementsJavaLangInterface.kt")
|
||||||
|
public void testInlineClassImplementsJavaLangInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsJavaLangInterface.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineClassInInitBlock.kt")
|
@TestMetadata("inlineClassInInitBlock.kt")
|
||||||
public void testInlineClassInInitBlock() throws Exception {
|
public void testInlineClassInInitBlock() throws Exception {
|
||||||
|
|||||||
+6
@@ -21515,6 +21515,12 @@ public class IrBlackBoxCodegenTestGenerated extends AbstractIrBlackBoxCodegenTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
@TestMetadata("inlineClassImplementsJavaLangInterface.kt")
|
||||||
|
public void testInlineClassImplementsJavaLangInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsJavaLangInterface.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
@TestMetadata("inlineClassInInitBlock.kt")
|
@TestMetadata("inlineClassInInitBlock.kt")
|
||||||
public void testInlineClassInInitBlock() throws Exception {
|
public void testInlineClassInInitBlock() throws Exception {
|
||||||
|
|||||||
+5
@@ -17470,6 +17470,11 @@ public class LightAnalysisModeTestGenerated extends AbstractLightAnalysisModeTes
|
|||||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsCollectionGeneric.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("inlineClassImplementsJavaLangInterface.kt")
|
||||||
|
public void testInlineClassImplementsJavaLangInterface() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassImplementsJavaLangInterface.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("inlineClassInInitBlock.kt")
|
@TestMetadata("inlineClassInInitBlock.kt")
|
||||||
public void testInlineClassInInitBlock() throws Exception {
|
public void testInlineClassInInitBlock() throws Exception {
|
||||||
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
runTest("compiler/testData/codegen/box/inlineClasses/inlineClassInInitBlock.kt", TransformersFunctions.getReplaceOptionalJvmInlineAnnotationWithReal());
|
||||||
|
|||||||
Reference in New Issue
Block a user