[FIR] Transform annotations of type refs in body resolve stage

Also fix building CFG for annotation calls
This commit is contained in:
Dmitriy Novozhilov
2021-04-12 18:51:15 +03:00
committed by TeamCityServer
parent aec13defc4
commit 1f0ecade34
25 changed files with 96 additions and 45 deletions
@@ -2,6 +2,6 @@
@Target(AnnotationTarget.TYPE)
annotation class Ann(val x: Int)
fun case_1(x: String): @Ann(unresolved_reference) String {
fun case_1(x: String): @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) String {
return x
}
@@ -5,4 +5,4 @@
@Target(AnnotationTarget.TYPE)
annotation class Ann(val x: Int)
abstract class Foo : @Ann(unresolved_reference) Any()
abstract class Foo : @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) Any()
@@ -8,7 +8,7 @@ annotation class Ann(val x: Int)
fun foo(i: Inv<@Ann(unresolved_reference) String>) {}
// TESTCASE NUMBER: 2
fun test(vararg a: @Ann(unresolved_reference) Any) {}
fun test(vararg a: @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) Any) {}
// TESTCASE NUMBER: 3
class A<T>(a: @Ann(unresolved_reference) T)
class A<T>(a: @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) T)
@@ -3,7 +3,7 @@
annotation class Ann(val x: Int)
// TESTCASE NUMBER: 1
abstract class Bar<T : @Ann(unresolved_reference) Any>
abstract class Bar<T : @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) Any>
/*
* TESTCASE NUMBER: 2
@@ -10,7 +10,7 @@ annotation class Ann(val x: Int)
* UNEXPECTED BEHAVIOUR
*/
fun case_1(a: Any) {
if (a is @Ann(unresolved_reference) String) return
if (a is @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) String) return
}
/*
@@ -18,7 +18,7 @@ fun case_1(a: Any) {
* UNEXPECTED BEHAVIOUR
*/
fun case_2(a: Any) {
a as @Ann(unresolved_reference) String // OK, no error in IDE and in the compiler
a as @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) String // OK, no error in IDE and in the compiler
}
/*
@@ -28,10 +28,10 @@ fun case_2(a: Any) {
fun case_3_1(a: Any) {}
fun case_3_2(a: Any) {
case_3_1(a as @Ann(unresolved_reference) String) // OK, no error in IDE and in the compiler
case_3_1(a as @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) String) // OK, no error in IDE and in the compiler
}
// TESTCASE NUMBER: 4
fun case_4(a: Any) {
val x = a as @Ann(unresolved_reference) String // ERROR, has error in IDE and in the compiler
val x = a as @Ann(<!UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) String // ERROR, has error in IDE and in the compiler
}
@@ -18,4 +18,4 @@ val case_1 = object : TypeToken<@Ann(unresolved_reference) String>() {}
*/
interface A
val case_2 = object: @Ann(unresolved_reference) A {}
val case_2 = object: @Ann(<!TOO_MANY_ARGUMENTS, TOO_MANY_ARGUMENTS, TOO_MANY_ARGUMENTS, TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) A {}
@@ -9,4 +9,4 @@ annotation class Ann
var <T> T.test
get() = 11
set(value: @Ann(unresolved_reference) Int) {}
set(value: @Ann(<!TOO_MANY_ARGUMENTS, TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>unresolved_reference<!>) Int) {}