Add test checking file annotations resolution

#KT-37219 Fixed
This commit is contained in:
Pavel Kirpichenkov
2020-07-14 12:52:22 +03:00
parent 36a46482c5
commit 79d7babb57
11 changed files with 316 additions and 0 deletions
@@ -0,0 +1,21 @@
/*All (1)*/class Foo/*None (2)*/(/*None (3)*/val prop: /*None (4)*/String/*(4)*//*(3)*/)/*(2)*/ {
/*None (5)*/class Inner {
/*None (6)*/val boo = 42/*(6)*/
/*None (7)*/fun inner() {}/*(7)*/
}/*(5)*/
/*All (8)*/fun first(/*All (9)*/arg1: /*All (10)*/String/*(10)*//*(9)*/) {
/*All (11)*/arg1/*(11)*/
}/*(8)*/
/*None (12)*/fun second(/*None (13)*/arg2: /*None (14)*/Int/*(14)*//*(13)*/) {
/*None (15)*/arg2/*(15)*/
}/*(12)*/
}/*(1)*/
/*None (16)*/class Bar/*None (17)*/(/*None (18)*/val baz: /*None (19)*/Int/*(19)*//*(18)*/)/*(17)*/ {
/*None (20)*/fun bee() {
/*None (21)*/val local = "abc"/*(21)*/
}/*(20)*/
}/*(16)*/
+21
View File
@@ -0,0 +1,21 @@
class Foo(val prop: String) {
class Inner {
val boo = 42
fun inner() {}
}
fun first(arg1: String) {
<caret>arg1
}
fun second(arg2: Int) {
arg2
}
}
class Bar(val baz: Int) {
fun bee() {
val local = "abc"
}
}
@@ -0,0 +1,14 @@
// COMPILER_ARGUMENTS: -Xopt-in=kotlin.RequiresOptIn
@file:/*All (1)*/OptIn/*(1)*/(/*All (2)*/Experimental/*(2)*/::class)
/*All (3)*/@/*All (4)*/Retention/*(4)*/(/*None (5)*/value/*(5)*/ = /*None (6)*/AnnotationRetention/*(6)*/./*None (7)*/BINARY/*(7)*/)
@/*All (8)*/RequiresOptIn/*(8)*/(/*All (9)*/level/*(9)*/ = /*All (10)*/RequiresOptIn/*(10)*/./*All (11)*/Level/*(11)*/./*All (12)*/WARNING/*(12)*/)
annotation class Experimental/*(3)*/
/*All (13)*/object MyObject/*(13)*/
/*All (14)*/@/*All (15)*/Experimental/*(15)*/
operator fun /*All (16)*/MyObject/*(16)*/.invoke(/*All (17)*/closure: () -> /*All (18)*/Unit/*(18)*//*(17)*/) {}/*(14)*/
/*All (19)*/fun d() = /*All (20)*//*All (21)*/MyObject/*(21)*/ {
}/*(20)*//*(19)*/
@@ -0,0 +1,14 @@
// COMPILER_ARGUMENTS: -Xopt-in=kotlin.RequiresOptIn
@file:OptIn(Experimental::class)
@Retention(value = AnnotationRetention.BINARY)
@RequiresOptIn(level = RequiresOptIn.Level.WARNING)
annotation class Experimental
object MyObject
@Experimental
operator fun MyObject.invoke(closure: () -> Unit) {}
fun d() = <caret>MyObject {
}
@@ -0,0 +1,7 @@
/*All (1)*/fun foo(/*All (2)*/arg: /*All (3)*/String/*(3)*//*(2)*/) {
/*All (4)*/arg/*(4)*/
}/*(1)*/
/*None (5)*/fun bar(/*None (6)*/arg: /*None (7)*/Int/*(7)*//*(6)*/) {
/*None (8)*/arg/*(8)*/
}/*(5)*/
@@ -0,0 +1,7 @@
fun foo(arg: String) {
<caret>arg
}
fun bar(arg: Int) {
arg
}
@@ -0,0 +1,6 @@
/*All (1)*/fun test(/*All (2)*/baz: /*All (3)*/Int/*(3)*//*(2)*/) {
/*Full (4)*/fun irrelevant() {
/*Full (5)*/val foo = "bar"/*(5)*/
}/*(4)*/
/*All (6)*/baz/*(6)*/ /*None (7)*/=/*(7)*/ 42
}/*(1)*/
@@ -0,0 +1,6 @@
fun test(baz: Int) {
fun irrelevant() {
val foo = "bar"
}
<caret>baz = 42
}