[FIR] Resolve annotations as calls
This commit is contained in:
committed by
Mikhail Glukhikh
parent
bc1fa8ed7f
commit
721b9b4d8c
+9
@@ -0,0 +1,9 @@
|
||||
annotation class Ann(val x: Int, val y: String, val z: String = "z")
|
||||
|
||||
@Ann(y = "y", x = 10)
|
||||
class A
|
||||
|
||||
annotation class AnnVarargs(val x: Int, vararg val y: String, val z: Int)
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>@AnnVarargs(1, "a", "b", "c", 2)<!>
|
||||
class B
|
||||
+43
@@ -0,0 +1,43 @@
|
||||
FILE: argumentsOfAnnotations.kt
|
||||
public final annotation class Ann : R|kotlin/Annotation| {
|
||||
public constructor(x: R|kotlin/Int|, y: R|kotlin/String|, z: R|kotlin/String| = String(z)): R|Ann| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/Int| = R|<local>/x|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public final val y: R|kotlin/String| = R|<local>/y|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
public final val z: R|kotlin/String| = R|<local>/z|
|
||||
public get(): R|kotlin/String|
|
||||
|
||||
}
|
||||
@R|Ann|(y = String(y), x = Int(10)) public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
public final annotation class AnnVarargs : R|kotlin/Annotation| {
|
||||
public constructor(x: R|kotlin/Int|, vararg y: R|kotlin/Array<out kotlin/String>|, z: R|kotlin/Int|): R|AnnVarargs| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
public final val x: R|kotlin/Int| = R|<local>/x|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
public final val y: R|kotlin/Array<out kotlin/String>| = R|<local>/y|
|
||||
public get(): R|kotlin/Array<out kotlin/String>|
|
||||
|
||||
public final val z: R|kotlin/Int| = R|<local>/z|
|
||||
public get(): R|kotlin/Int|
|
||||
|
||||
}
|
||||
@R|AnnVarargs|(Int(1), String(a), String(b), String(c), Int(2)) public final class B : R|kotlin/Any| {
|
||||
public constructor(): R|B| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
+15
@@ -0,0 +1,15 @@
|
||||
// FILE: Ann.java
|
||||
|
||||
public @interface Ann {
|
||||
String s();
|
||||
int x();
|
||||
int y() default 1;
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
@Ann(x = 10, s = "")
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann(10, "")<!>
|
||||
@Ann(x = 10, s = "", y = 10)
|
||||
class A
|
||||
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
FILE: main.kt
|
||||
@R|Ann|(x = Int(10), s = String()) @R|Ann|(Int(10), String()) @R|Ann|(x = Int(10), s = String(), y = Int(10)) public final class A : R|kotlin/Any| {
|
||||
public constructor(): R|A| {
|
||||
super<R|kotlin/Any|>()
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -43,6 +43,6 @@ annotation class Ann(val x: Byte)
|
||||
|
||||
@Ann(10)
|
||||
fun test_6() {
|
||||
@Ann(300)
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann(300)<!>
|
||||
val x = ""
|
||||
}
|
||||
|
||||
+1
-1
@@ -61,6 +61,6 @@ FILE: integerLiteralTypes.kt
|
||||
public get(): R|kotlin/Byte|
|
||||
|
||||
}
|
||||
@R|Ann|(Int(10)) public final fun test_6(): R|kotlin/Unit| {
|
||||
@R|Ann|(Byte(10)) public final fun test_6(): R|kotlin/Unit| {
|
||||
@R|Ann|(Int(300)) lval x: R|kotlin/String| = String()
|
||||
}
|
||||
|
||||
+16
@@ -0,0 +1,16 @@
|
||||
// FILE: Ann.java
|
||||
|
||||
public @interface Ann {
|
||||
String[] value();
|
||||
}
|
||||
|
||||
// FILE: main.kt
|
||||
|
||||
@Ann("a", "b")
|
||||
fun test_1() {}
|
||||
|
||||
<!INAPPLICABLE_CANDIDATE!>@Ann(arrayOf("a", "b"))<!>
|
||||
fun test_2() {}
|
||||
|
||||
@Ann(*arrayOf("a", "b"))
|
||||
fun test_3() {}
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
FILE: main.kt
|
||||
@R|Ann|(vararg(String(a), String(b))) public final fun test_1(): R|kotlin/Unit| {
|
||||
}
|
||||
@R|Ann|(R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(a), String(b)))) public final fun test_2(): R|kotlin/Unit| {
|
||||
}
|
||||
@R|Ann|(vararg(*R|kotlin/arrayOf|<R|kotlin/String|>(vararg(String(a), String(b))))) public final fun test_3(): R|kotlin/Unit| {
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE")
|
||||
@kotlin.internal.LowPriorityInOverloadResolution
|
||||
<!HIDDEN!>@kotlin.internal.LowPriorityInOverloadResolution<!>
|
||||
fun foo(): Int = 1
|
||||
|
||||
fun foo(): String = ""
|
||||
@@ -7,4 +7,4 @@ fun foo(): String = ""
|
||||
fun test() {
|
||||
val s = foo()
|
||||
s.length
|
||||
}
|
||||
}
|
||||
|
||||
Generated
+15
@@ -445,6 +445,16 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("argumentsOfAnnotations.kt")
|
||||
public void testArgumentsOfAnnotations() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("argumentsOfJavaAnnotation.kt")
|
||||
public void testArgumentsOfJavaAnnotation() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfJavaAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("default.kt")
|
||||
public void testDefault() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/default.kt");
|
||||
@@ -485,6 +495,11 @@ public class FirDiagnosticsTestGenerated extends AbstractFirDiagnosticsTest {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/invoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaAnnotationsWithArrayValue.kt")
|
||||
public void testJavaAnnotationsWithArrayValue() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/javaAnnotationsWithArrayValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayVariance.kt")
|
||||
public void testJavaArrayVariance() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/javaArrayVariance.kt");
|
||||
|
||||
+15
@@ -445,6 +445,16 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/ambiguityOnJavaOverride.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("argumentsOfAnnotations.kt")
|
||||
public void testArgumentsOfAnnotations() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfAnnotations.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("argumentsOfJavaAnnotation.kt")
|
||||
public void testArgumentsOfJavaAnnotation() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/argumentsOfJavaAnnotation.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("default.kt")
|
||||
public void testDefault() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/default.kt");
|
||||
@@ -485,6 +495,11 @@ public class FirDiagnosticsWithLightTreeTestGenerated extends AbstractFirDiagnos
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/invoke.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaAnnotationsWithArrayValue.kt")
|
||||
public void testJavaAnnotationsWithArrayValue() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/javaAnnotationsWithArrayValue.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("javaArrayVariance.kt")
|
||||
public void testJavaArrayVariance() throws Exception {
|
||||
runTest("compiler/fir/analysis-tests/testData/resolve/arguments/javaArrayVariance.kt");
|
||||
|
||||
Reference in New Issue
Block a user