[FIR] add tests on annotations for delegated getter during implicit type phase

^KT-62874
This commit is contained in:
Dmitrii Gridin
2023-10-24 21:47:14 +02:00
committed by Space Team
parent 11e7500d9e
commit 1b636bf450
13 changed files with 547 additions and 0 deletions
@@ -9550,6 +9550,18 @@ public class FirLightTreeOldFrontendDiagnosticsTestGenerated extends AbstractFir
runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt");
}
@Test
@TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt")
public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt");
}
@Test
@TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt")
public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt");
}
@Test
@TestMetadata("delegatedPropertyOverridedInTrait.kt")
public void testDelegatedPropertyOverridedInTrait() throws Exception {
@@ -9556,6 +9556,18 @@ public class FirPsiOldFrontendDiagnosticsTestGenerated extends AbstractFirPsiDia
runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt");
}
@Test
@TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt")
public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt");
}
@Test
@TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt")
public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt");
}
@Test
@TestMetadata("delegatedPropertyOverridedInTrait.kt")
public void testDelegatedPropertyOverridedInTrait() throws Exception {
@@ -0,0 +1,17 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -UNUSED_PARAMETER
import kotlin.reflect.KProperty
@get:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@set:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@setparam:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@delegate:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
var foo: Int by MyDelegate()
@Repeatable
annotation class Anno(val s: Int)
class MyDelegate {
operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {}
}
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// IGNORE_REVERSED_RESOLVE
import kotlin.reflect.KProperty
@get:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST, TYPECHECKER_HAS_RUN_INTO_RECURSIVE_PROBLEM!>foo<!>)
@set:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@setparam:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@delegate:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
var foo by MyDelegate()
@Repeatable
annotation class Anno(val i: Int)
class MyDelegate {
operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {}
}
@@ -0,0 +1,17 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER
// IGNORE_REVERSED_RESOLVE
import kotlin.reflect.KProperty
@get:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@set:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@setparam:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
@delegate:Anno(<!ANNOTATION_ARGUMENT_MUST_BE_CONST!>foo<!>)
var foo by MyDelegate()
@Repeatable
annotation class Anno(val i: Int)
class MyDelegate {
operator fun getValue(thisRef: Any?, property: KProperty<*>) = 42
operator fun setValue(thisRef: Any?, property: KProperty<*>, value: Int) {}
}
@@ -9556,6 +9556,18 @@ public class DiagnosticTestGenerated extends AbstractDiagnosticTest {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/defaultSetter.kt");
}
@Test
@TestMetadata("delegateWithAnnotationOnAccessorWithExplicitType.kt")
public void testDelegateWithAnnotationOnAccessorWithExplicitType() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithExplicitType.kt");
}
@Test
@TestMetadata("delegateWithAnnotationOnAccessorWithImplicitType.kt")
public void testDelegateWithAnnotationOnAccessorWithImplicitType() throws Exception {
runTest("compiler/testData/diagnostics/tests/delegatedProperty/delegateWithAnnotationOnAccessorWithImplicitType.kt");
}
@Test
@TestMetadata("delegatedPropertyOverridedInTrait.kt")
public void testDelegatedPropertyOverridedInTrait() throws Exception {