FIR IDE: add more tests about annotation resolution
This commit is contained in:
committed by
TeamCityServer
parent
e95313acbb
commit
464eecef03
+5
@@ -55,6 +55,11 @@ abstract class AbstractResolveCallTest : AbstractHLApiSingleModuleTest() {
|
||||
?: error("Only single annotation entry is supported for now")
|
||||
annotationEntry.resolveCall()
|
||||
}
|
||||
is KtFileAnnotationList -> {
|
||||
val annotationEntry = element.annotationEntries.singleOrNull()
|
||||
?: error("Only single annotation entry is supported for now")
|
||||
annotationEntry.resolveCall()
|
||||
}
|
||||
else -> error("Selected element type (${element::class.simpleName}) is not supported for resolveCall()")
|
||||
}
|
||||
|
||||
|
||||
+90
@@ -66,6 +66,96 @@ public class ResolveCallTestGenerated extends AbstractResolveCallTest {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationInAnnotation_vararg.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnDelegate.kt")
|
||||
public void testAnnotationOnDelegate() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnDelegate.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnExpression_asT.kt")
|
||||
public void testAnnotationOnExpression_asT() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnExpression_asT.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnExpression_destructuring.kt")
|
||||
public void testAnnotationOnExpression_destructuring() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnExpression_destructuring.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnExpression_if.kt")
|
||||
public void testAnnotationOnExpression_if() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnExpression_if.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnExpression_whenBranch.kt")
|
||||
public void testAnnotationOnExpression_whenBranch() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnExpression_whenBranch.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnFile.kt")
|
||||
public void testAnnotationOnFile() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnFile.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnParameter_param.kt")
|
||||
public void testAnnotationOnParameter_param() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnParameter_param.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnParameter_parameterProperty.kt")
|
||||
public void testAnnotationOnParameter_parameterProperty() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnParameter_parameterProperty.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnParameter_reified.kt")
|
||||
public void testAnnotationOnParameter_reified() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnParameter_reified.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnParameter_setparam.kt")
|
||||
public void testAnnotationOnParameter_setparam() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnParameter_setparam.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnProperty_field.kt")
|
||||
public void testAnnotationOnProperty_field() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnProperty_field.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnProperty_get.kt")
|
||||
public void testAnnotationOnProperty_get() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnProperty_get.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnProperty_property.kt")
|
||||
public void testAnnotationOnProperty_property() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnProperty_property.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnProperty_set.kt")
|
||||
public void testAnnotationOnProperty_set() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnProperty_set.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("annotationOnReceiver.kt")
|
||||
public void testAnnotationOnReceiver() throws Exception {
|
||||
runTest("analysis/analysis-api/testData/analysisSession/resolveCall/annotationOnReceiver.kt");
|
||||
}
|
||||
|
||||
@Test
|
||||
@TestMetadata("arrayOfInAnnotation.kt")
|
||||
public void testArrayOfInAnnotation() throws Exception {
|
||||
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
<expr>@delegate:Suppress</expr>
|
||||
val annotatedDelegate by lazy { 1 + 1 }
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
|
||||
+8
@@ -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
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { "UNCHECKED_CAST" -> (vararg names: kotlin.String) }
|
||||
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
fun foo(data: Any) {
|
||||
<expr>@Suppress("UNCHECKED_CAST")</expr>
|
||||
val (k, v) = data as Pair<String, String>
|
||||
}
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
null
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
val a: Int = 42
|
||||
val b: Int = 24
|
||||
val c = <expr>@Suppress</expr> if (a > 2) a else b
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
|
||||
Vendored
+7
@@ -0,0 +1,7 @@
|
||||
fun annotatedSwitch(str: String) =
|
||||
when {
|
||||
<expr>@Suppress("DEPRECATION")</expr>
|
||||
str.isBlank() -> null
|
||||
str.isNotEmpty() != null -> null
|
||||
else -> 1
|
||||
}
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { "DEPRECATION" -> (vararg names: kotlin.String) }
|
||||
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
// WITH_STDLIB
|
||||
<expr>@file:JvmName("Foo")</expr>
|
||||
package some.pkg
|
||||
|
||||
val p : Int = 42
|
||||
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { "Foo" -> (name: kotlin.String) }
|
||||
targetFunction = <constructor>(name: kotlin.String): kotlin.jvm.JvmName
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
annotation class Anno
|
||||
|
||||
class Test1(<expr>@param:Anno</expr> var bar: Int)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
annotation class Anno
|
||||
|
||||
class Test1(<expr>@Anno</expr> var bar: Int)
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
Vendored
+1
@@ -0,0 +1 @@
|
||||
inline fun <reified T> functionWithParamAnnotation(<expr>@Suppress("s")</expr> t: T): T = t
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { "s" -> (vararg names: kotlin.String) }
|
||||
targetFunction = <constructor>(vararg names: kotlin.String): kotlin.Suppress
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
annotation class Anno
|
||||
|
||||
class Test1(<expr>@setparam:Anno</expr> var bar: Int)
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
+9
@@ -0,0 +1,9 @@
|
||||
annotation class Anno
|
||||
|
||||
<expr>@field:Anno</expr>
|
||||
var p : Int = 42
|
||||
set(value) {
|
||||
if (value > field) {
|
||||
field = value
|
||||
}
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
annotation class Anno
|
||||
|
||||
<expr>@get:Anno</expr>
|
||||
val p : Int = 42
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
Vendored
+4
@@ -0,0 +1,4 @@
|
||||
annotation class Anno
|
||||
|
||||
<expr>@property:Anno</expr>
|
||||
val p : Int = 42
|
||||
Vendored
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
+4
@@ -0,0 +1,4 @@
|
||||
annotation class Anno
|
||||
|
||||
<expr>@set:Anno</expr>
|
||||
var p : Int = 42
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
+6
@@ -0,0 +1,6 @@
|
||||
annotation class Anno
|
||||
|
||||
<expr>@receiver:Anno</expr>
|
||||
fun String.foo() {
|
||||
return "$this (${this.length})"
|
||||
}
|
||||
+3
@@ -0,0 +1,3 @@
|
||||
KtAnnotationCall:
|
||||
argumentMapping = { }
|
||||
targetFunction = <constructor>(): Anno
|
||||
Reference in New Issue
Block a user