[FIR] Fix case with lazy resolve in expect-actual annotation checker
Unresolved annotation arguments were treated as absent arguments, which lead to false-positive reports. Add assert and test for that and fix. MR: KT-MR-12245 ^KT-60671 Fixed
This commit is contained in:
committed by
Space Team
parent
4c75fb108f
commit
0fd700de21
Vendored
+4
-2
@@ -1,5 +1,7 @@
|
||||
// LL_FIR_DIVERGENCE
|
||||
// The reason is bug, which will be fixed in next commit
|
||||
// Difference to FIR is false-positive report of MISSING_DEPENDENCY_SUPERCLASS.
|
||||
// This is because JVM Enum with `java.io.Serializable` superclass resolved instead of common builtin Enum.
|
||||
// Must be fixed with KT-61757.
|
||||
// LL_FIR_DIVERGENCE
|
||||
|
||||
// Test for ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT diagnostic when annotations arguments are lazily resolved.
|
||||
@@ -25,7 +27,7 @@ expect fun withEmptyArguments_positive()
|
||||
|
||||
// MODULE: main()()(common)
|
||||
// TARGET_PLATFORM: JVM
|
||||
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onType_negative<!>(): @Ann("") Any = Any()
|
||||
actual fun onType_negative(): @Ann("") Any = Any()
|
||||
actual fun <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>onType_positive<!>(): @Ann("incorrect") Any = Any()
|
||||
|
||||
@Ann("")
|
||||
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// This test is for the case when expect annotation is FirAnnotationCall and actual annotation is not FirAnnotationCall
|
||||
// MODULE: common
|
||||
// TARGET_PLATFORM: Common
|
||||
expect annotation class Ann(val p: Int)
|
||||
|
||||
@Ann(p = 1)
|
||||
expect class Foo
|
||||
|
||||
// MODULE: main()()(common)
|
||||
// TARGET_PLATFORM: JVM
|
||||
// FILE: Foo.kt
|
||||
actual annotation class Ann actual constructor(actual val p: Int)
|
||||
|
||||
<!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>actual typealias <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>Foo<!> = FooImpl<!>
|
||||
|
||||
// FILE: FooImpl.java
|
||||
@Ann(p = 2)
|
||||
public class FooImpl {
|
||||
}
|
||||
+19
@@ -0,0 +1,19 @@
|
||||
// This test is for the case when expect annotation is FirAnnotationCall and actual annotation is not FirAnnotationCall
|
||||
// MODULE: common
|
||||
// TARGET_PLATFORM: Common
|
||||
expect annotation class Ann(val p: Int)
|
||||
|
||||
@Ann(p = 1)
|
||||
expect class Foo
|
||||
|
||||
// MODULE: main()()(common)
|
||||
// TARGET_PLATFORM: JVM
|
||||
// FILE: Foo.kt
|
||||
actual annotation class Ann actual constructor(actual val p: Int)
|
||||
|
||||
actual typealias <!ACTUAL_ANNOTATIONS_NOT_MATCH_EXPECT!>Foo<!> = FooImpl
|
||||
|
||||
// FILE: FooImpl.java
|
||||
@Ann(p = 2)
|
||||
public class FooImpl {
|
||||
}
|
||||
Reference in New Issue
Block a user