FIR: Transform annotations on type arguments during body resolve.

This commit is contained in:
Mark Punzalan
2021-10-06 07:02:11 +00:00
committed by TeamCityServer
parent d6e428cd98
commit 4f0b52b653
14 changed files with 150 additions and 63 deletions
@@ -1,26 +0,0 @@
// !DIAGNOSTICS: -UNUSED_VARIABLE
// TESTCASE NUMBER: 1, 2
@Target(AnnotationTarget.TYPE)
annotation class Ann(val x: Int)
/*
* TESTCASE NUMBER: 1
* UNEXPECTED BEHAVIOUR
*/
fun case_1() {
val x: (Int) -> @Ann(unresolved_reference) Unit = {} // OK, no error in IDE and in the compiler
}
/*
* TESTCASE NUMBER: 2
* UNEXPECTED BEHAVIOUR
*/
fun case_2() {
val x: (@Ann(unresolved_reference) Int) -> Unit = { a: Int -> println(a) } // OK, no error in IDE and in the compiler
}
// TESTCASE NUMBER: 3
fun case_3() {
val x: (@Ann(unresolved_reference) Int) -> Unit = { a -> println(a) } // ERROR (if argument type isn't specified explicitly)
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_VARIABLE
/*
@@ -5,7 +5,7 @@
annotation class Ann(val x: Int)
// TESTCASE NUMBER: 1
fun foo(i: Inv<@Ann(unresolved_reference) String>) {}
fun foo(i: Inv<@Ann(<!UNRESOLVED_REFERENCE!>unresolved_reference<!>) String>) {}
// TESTCASE NUMBER: 2
fun test(vararg a: @Ann(unresolved_reference) Any) {}
@@ -2,4 +2,4 @@
@Target(AnnotationTarget.TYPE)
annotation class Ann(val x: Int)
fun case_1(): Inv<@Ann(unresolved_reference) String> = TODO()
fun case_1(): Inv<@Ann(<!UNRESOLVED_REFERENCE!>unresolved_reference<!>) String> = TODO()
@@ -1,20 +0,0 @@
// TESTCASE NUMBER: 1, 2
@Target(AnnotationTarget.TYPE)
annotation class Ann
/*
* TESTCASE NUMBER: 1
* UNEXPECTED BEHAVIOUR
*/
open class TypeToken<T>
val case_1 = object : TypeToken<@Ann(unresolved_reference) String>() {}
/*
* TESTCASE NUMBER: 2
* UNEXPECTED BEHAVIOUR
*/
interface A
val case_2 = object: @Ann(<!TOO_MANY_ARGUMENTS, UNRESOLVED_REFERENCE!>unresolved_reference<!>) A {}
@@ -1,4 +1,4 @@
// FIR_IDENTICAL
/*
* KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE)
*