FIR IDE: add more tests about annotation resolution

This commit is contained in:
Jinseong Jeon
2021-09-24 11:35:02 -07:00
committed by TeamCityServer
parent e95313acbb
commit 464eecef03
32 changed files with 205 additions and 0 deletions
@@ -0,0 +1,2 @@
<expr>@delegate:Suppress</expr>
val annotatedDelegate by lazy { 1 + 1 }
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
@@ -0,0 +1,8 @@
class A<T>(val value : T)
class B<T>
fun <T> A<T>.toB(): B<T> {
<expr>@Suppress("UNCHECKED_CAST")</expr>
val v = (value as? Long)?.let { it.toInt() } as T ?: value
return v
}
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { "UNCHECKED_CAST" -> (vararg names: kotlin.String) }
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
@@ -0,0 +1,4 @@
fun foo(data: Any) {
<expr>@Suppress("UNCHECKED_CAST")</expr>
val (k, v) = data as Pair<String, String>
}
@@ -0,0 +1,3 @@
val a: Int = 42
val b: Int = 24
val c = <expr>@Suppress</expr> if (a > 2) a else b
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
@@ -0,0 +1,7 @@
fun annotatedSwitch(str: String) =
when {
<expr>@Suppress("DEPRECATION")</expr>
str.isBlank() -> null
str.isNotEmpty() != null -> null
else -> 1
}
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { "DEPRECATION" -> (vararg names: kotlin.String) }
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
@@ -0,0 +1,6 @@
// WITH_STDLIB
<expr>@file:JvmName("Foo")</expr>
package some.pkg
val p : Int = 42
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { "Foo" -> (name: kotlin.String) }
targetFunction = <constructor>(name: kotlin.String): kotlin.jvm.JvmName
@@ -0,0 +1,3 @@
annotation class Anno
class Test1(<expr>@param:Anno</expr> var bar: Int)
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno
@@ -0,0 +1,3 @@
annotation class Anno
class Test1(<expr>@Anno</expr> var bar: Int)
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno
@@ -0,0 +1 @@
inline fun <reified T> functionWithParamAnnotation(<expr>@Suppress("s")</expr> t: T): T = t
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { "s" -> (vararg names: kotlin.String) }
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
@@ -0,0 +1,3 @@
annotation class Anno
class Test1(<expr>@setparam:Anno</expr> var bar: Int)
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno
@@ -0,0 +1,9 @@
annotation class Anno
<expr>@field:Anno</expr>
var p : Int = 42
set(value) {
if (value > field) {
field = value
}
}
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno
@@ -0,0 +1,4 @@
annotation class Anno
<expr>@get:Anno</expr>
val p : Int = 42
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno
@@ -0,0 +1,4 @@
annotation class Anno
<expr>@property:Anno</expr>
val p : Int = 42
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno
@@ -0,0 +1,4 @@
annotation class Anno
<expr>@set:Anno</expr>
var p : Int = 42
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno
@@ -0,0 +1,6 @@
annotation class Anno
<expr>@receiver:Anno</expr>
fun String.foo() {
return "$this (${this.length})"
}
@@ -0,0 +1,3 @@
KtAnnotationCall:
argumentMapping = { }
targetFunction = <constructor>(): Anno