[FE1.0] Fix false reporting of non-matching actual annotations in IDE
It was reported because in composite module analysis we have both expect and actual annotation descriptors, which may differ. This may lead to bugs in the checker of ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic. `fqName` comparison can be safely removed, because we already check types in `areCompatibleExpectActualTypes`. Tests: - typealiasedAnnotation.kt - for annotation use (so it has different ClassId) - typealiasedAnnotationAsArgument.kt - when typealiased annotation used in another annotation as argument - sourceRetentionAnnotationsWhenTypealias.kt - tests same as compiler/testData/diagnostics/tests/multiplatform/annotationMatching/sourceRetentionAnnotationsWhenTypealias.kt No special test added for opt-in, because it's prohibited to have expect/actual opt-ins by EXPECT_ACTUAL_OPT_IN_ANNOTATION checker. ^KTIJ-26700
This commit is contained in:
committed by
Space Team
parent
dce1c1c70a
commit
77ab13400e
+15
@@ -0,0 +1,15 @@
|
||||
// FIR_IDENTICAL
|
||||
// WITH_STDLIB
|
||||
// MODULE: common
|
||||
// TARGET_PLATFORM: Common
|
||||
expect annotation class Ann() // No @Retention SOURCE set
|
||||
|
||||
@Ann
|
||||
expect annotation class CommonVolatile
|
||||
|
||||
// MODULE: main()()(common)
|
||||
// TARGET_PLATFORM: JVM
|
||||
@Retention(AnnotationRetention.SOURCE)
|
||||
actual annotation class Ann
|
||||
|
||||
actual typealias CommonVolatile = kotlin.jvm.Volatile
|
||||
+22
@@ -0,0 +1,22 @@
|
||||
// FIR_IDENTICAL
|
||||
// MODULE: common
|
||||
// TARGET_PLATFORM: Common
|
||||
expect annotation class Test()
|
||||
|
||||
@Test
|
||||
expect fun unexpandedOnActual()
|
||||
|
||||
@Test
|
||||
expect fun expandedOnActual()
|
||||
|
||||
// MODULE: main()()(common)
|
||||
annotation class JunitTestInLib
|
||||
|
||||
actual typealias Test = JunitTestInLib
|
||||
|
||||
@Test
|
||||
actual fun unexpandedOnActual() {}
|
||||
|
||||
@JunitTestInLib
|
||||
actual fun expandedOnActual() {}
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// FIR_IDENTICAL
|
||||
// DIAGNOSTICS: -TYPE_MISMATCH
|
||||
// MODULE: common
|
||||
// TARGET_PLATFORM: Common
|
||||
expect annotation class Typealiased()
|
||||
|
||||
annotation class Ann(val p: Typealiased)
|
||||
|
||||
@Ann(Typealiased())
|
||||
expect fun test()
|
||||
|
||||
// MODULE: main()()(common)
|
||||
annotation class TypealiasedImpl
|
||||
|
||||
actual typealias Typealiased = TypealiasedImpl
|
||||
|
||||
@Ann(Typealiased())
|
||||
actual fun test() {}
|
||||
|
||||
Reference in New Issue
Block a user