[IR] Fix IR expect-actual annotations checker in case when annotation is actual typealias
^KT-60830 Fixed
This commit is contained in:
committed by
Space Team
parent
5ed3f308fa
commit
31f21d8593
+6
@@ -334,6 +334,12 @@ public class FirOldFrontendMPPDiagnosticsWithLightTreeTestGenerated extends Abst
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/typealiasToKtLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("withAnnotationActualTypealias.kt")
|
||||
public void testWithAnnotationActualTypealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/withAnnotationActualTypealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("withOtherIncomatibilities.kt")
|
||||
public void testWithOtherIncomatibilities() throws Exception {
|
||||
|
||||
+6
@@ -334,6 +334,12 @@ public class FirOldFrontendMPPDiagnosticsWithPsiTestGenerated extends AbstractFi
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/typealiasToKtLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("withAnnotationActualTypealias.kt")
|
||||
public void testWithAnnotationActualTypealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/withAnnotationActualTypealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("withOtherIncomatibilities.kt")
|
||||
public void testWithOtherIncomatibilities() throws Exception {
|
||||
|
||||
+4
-3
@@ -471,9 +471,9 @@ internal abstract class IrExpectActualMatchingContext(
|
||||
return expectToActualClassMap[classId]?.classId ?: classId
|
||||
}
|
||||
|
||||
private class AnnotationCallInfoImpl(val irElement: IrConstructorCall) : AnnotationCallInfo {
|
||||
private inner class AnnotationCallInfoImpl(val irElement: IrConstructorCall) : AnnotationCallInfo {
|
||||
override val classId: ClassId?
|
||||
get() = irElement.type.getClass()?.classId
|
||||
get() = getAnnotationClass()?.classId
|
||||
|
||||
override val isRetentionSource: Boolean
|
||||
get() = getAnnotationClass()?.getAnnotationRetention() == KotlinRetention.SOURCE
|
||||
@@ -482,7 +482,8 @@ internal abstract class IrExpectActualMatchingContext(
|
||||
get() = getAnnotationClass()?.hasAnnotation(OptInNames.REQUIRES_OPT_IN_FQ_NAME) ?: false
|
||||
|
||||
private fun getAnnotationClass(): IrClass? {
|
||||
return irElement.symbol.owner.parent as? IrClass
|
||||
val annotationClass = irElement.type.getClass() ?: return null
|
||||
return expectToActualClassMap[annotationClass.classId]?.owner ?: annotationClass
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
+21
@@ -0,0 +1,21 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: m1-common
|
||||
// FILE: common.kt
|
||||
expect annotation class Ann()
|
||||
|
||||
@Ann
|
||||
expect class MatchUseSameName
|
||||
|
||||
@Ann
|
||||
expect class MatchUseTypealiasedName
|
||||
|
||||
// MODULE: m1-jvm()()(m1-common)
|
||||
// FILE: jvm.kt
|
||||
annotation class AnnImpl
|
||||
actual typealias Ann = AnnImpl
|
||||
|
||||
@Ann
|
||||
actual class MatchUseSameName
|
||||
|
||||
@AnnImpl
|
||||
actual class MatchUseTypealiasedName
|
||||
Generated
+6
@@ -22977,6 +22977,12 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/typealiasToKtLibrary.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("withAnnotationActualTypealias.kt")
|
||||
public void testWithAnnotationActualTypealias() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/multiplatform/annotationMatching/withAnnotationActualTypealias.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("withOtherIncomatibilities.kt")
|
||||
public void testWithOtherIncomatibilities() throws Exception {
|
||||
|
||||
Reference in New Issue
Block a user