From 1f0ecade349c1f5f397561dd2896cebe8d662dd5 Mon Sep 17 00:00:00 2001 From: Dmitriy Novozhilov Date: Mon, 12 Apr 2021 18:51:15 +0300 Subject: [PATCH] [FIR] Transform annotations of type refs in body resolve stage Also fix building CFG for annotation calls --- .../RedundantReturnUnitTypeChecker.kt | 2 +- .../resolve/multifile/Annotations.fir.txt | 4 +-- .../body/resolve/FirBodyResolveTransformer.kt | 12 ++++---- .../FirExpressionsResolveTransformer.kt | 7 +++-- .../tests/annotations/typeUse/kt25876.fir.kt | 6 ++-- ...eForArgumentCallWithExactAnnotation.fir.kt | 2 +- ...rArgumentCallWithExactAnnotation_ni.fir.kt | 2 +- ...tponedCompletionWithExactAnnotation.fir.kt | 2 +- ...nedCompletionWithExactAnnotation_ni.fir.kt | 2 +- .../inference/completion/withExact.fir.kt | 2 +- .../elvisOperatorAgainstFlexibleType.fir.kt | 20 +++++++++++++ .../elvisOperatorAgainstFlexibleType.kt | 3 +- .../internalAnnotationsOnTypes.fir.kt | 30 +++++++++++++++++++ .../internalAnnotationsOnTypes.kt | 3 +- .../noInferAndLowPriority.fir.kt | 2 +- .../noInferAnnotation.fir.kt | 10 +++---- .../propagationOfNoInferAnnotation.kt | 6 ++-- .../propagationOfNoInferAnnotation.txt | 4 +-- .../annotations/type-annotations/neg/1.fir.kt | 2 +- .../annotations/type-annotations/neg/2.fir.kt | 2 +- .../annotations/type-annotations/neg/3.fir.kt | 4 +-- .../annotations/type-annotations/neg/5.fir.kt | 2 +- .../annotations/type-annotations/neg/6.fir.kt | 8 ++--- .../annotations/type-annotations/neg/7.fir.kt | 2 +- .../annotations/type-annotations/neg/9.fir.kt | 2 +- 25 files changed, 96 insertions(+), 45 deletions(-) create mode 100644 compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.fir.kt create mode 100644 compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.fir.kt diff --git a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantReturnUnitTypeChecker.kt b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantReturnUnitTypeChecker.kt index 693d9c8b95a..18f8788142f 100644 --- a/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantReturnUnitTypeChecker.kt +++ b/compiler/fir/analysis-tests/testData/resolve/extendedCheckers/RedundantReturnUnitTypeChecker.kt @@ -5,7 +5,7 @@ interface I { } class A { - fun too(): @Annotation Unit {} + fun too(): @Annotation Unit {} fun foo(): Unit { diff --git a/compiler/fir/analysis-tests/testData/resolve/multifile/Annotations.fir.txt b/compiler/fir/analysis-tests/testData/resolve/multifile/Annotations.fir.txt index 295583b8438..165e50955bc 100644 --- a/compiler/fir/analysis-tests/testData/resolve/multifile/Annotations.fir.txt +++ b/compiler/fir/analysis-tests/testData/resolve/multifile/Annotations.fir.txt @@ -69,9 +69,9 @@ FILE: main.kt public get(): R|kotlin/String| } - @R|annotations/WithString|(String(xyz)) public final class Second : @R|annotations/WithInt|(IntegerLiteral(0)) R|test/First| { + @R|annotations/WithString|(String(xyz)) public final class Second : @R|annotations/WithInt|(Int(0)) R|test/First| { public constructor(y: R|kotlin/Char|): R|test/Second| { - super<@R|annotations/WithInt|(IntegerLiteral(0)) R|test/First|>() + super<@R|annotations/WithInt|(Int(0)) R|test/First|>() } public final val y: R|kotlin/Char| = R|/y| diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt index 61174068c08..352276cb077 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirBodyResolveTransformer.kt @@ -61,12 +61,14 @@ open class FirBodyResolveTransformer( } override fun transformTypeRef(typeRef: FirTypeRef, data: ResolutionMode): FirResolvedTypeRef { - if (typeRef is FirResolvedTypeRef) { - return typeRef - } - return typeResolverTransformer.withFile(context.file) { - transformTypeRef(typeRef, FirCompositeScope(components.createCurrentScopeList())) + val resolvedTypeRef = if (typeRef is FirResolvedTypeRef) { + typeRef + } else { + typeResolverTransformer.withFile(context.file) { + transformTypeRef(typeRef, FirCompositeScope(components.createCurrentScopeList())) + } } + return resolvedTypeRef.transformAnnotations(this, data) } override fun transformImplicitTypeRef(implicitTypeRef: FirImplicitTypeRef, data: ResolutionMode): FirTypeRef { diff --git a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt index fda789cf059..a6172dd807a 100644 --- a/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt +++ b/compiler/fir/resolve/src/org/jetbrains/kotlin/fir/resolve/transformers/body/resolve/FirExpressionsResolveTransformer.kt @@ -782,14 +782,15 @@ open class FirExpressionsResolveTransformer(transformer: FirBodyResolveTransform annotationCall: FirAnnotationCall, status: FirAnnotationResolveStatus ): FirAnnotationCall { - dataFlowAnalyzer.enterAnnotationCall(annotationCall) return withFirArrayOfCallTransformer { annotationCall.transformAnnotationTypeRef(transformer, ResolutionMode.ContextIndependent) if (status == FirAnnotationResolveStatus.PartiallyResolved) return annotationCall - val result = callResolver.resolveAnnotationCall(annotationCall) ?: return annotationCall + dataFlowAnalyzer.enterAnnotationCall(annotationCall) + val result = callResolver.resolveAnnotationCall(annotationCall) + dataFlowAnalyzer.exitAnnotationCall(result ?: annotationCall) + if (result == null) return annotationCall callCompleter.completeCall(result, noExpectedType) result.replaceResolveStatus(status) - dataFlowAnalyzer.exitAnnotationCall(result) annotationCall } } diff --git a/compiler/testData/diagnostics/tests/annotations/typeUse/kt25876.fir.kt b/compiler/testData/diagnostics/tests/annotations/typeUse/kt25876.fir.kt index a7b1fb3f5f0..fcb75ef2732 100644 --- a/compiler/testData/diagnostics/tests/annotations/typeUse/kt25876.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/typeUse/kt25876.fir.kt @@ -4,10 +4,10 @@ @Target(AnnotationTarget.TYPE) annotation class Anno(val value: String) -fun foo(x: String): @Anno(Lorem, ipsum::class, "dolor", sit-amet) String { // OK +fun foo(x: String): @Anno(Lorem, ipsum::class, "dolor", sit-amet) String { // OK return x } -abstract class Foo : @Anno(o_O) Throwable() // OK +abstract class Foo : @Anno(o_O) Throwable() // OK -abstract class Bar // OK +abstract class BarO_o) Any> // OK diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation.fir.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation.fir.kt index f34eb010880..8891ffef862 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation.fir.kt @@ -6,7 +6,7 @@ interface B : A interface C : A @Suppress("INVISIBLE_REFERENCE") -fun select(x: K, y: K): @kotlin.internal.Exact K = x +fun select(x: K, y: K): @kotlin.internal.Exact K = x fun foo(a: Any) {} diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation_ni.fir.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation_ni.fir.kt index 004d8442034..f57407ef00e 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation_ni.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/lessSpecificTypeForArgumentCallWithExactAnnotation_ni.fir.kt @@ -6,7 +6,7 @@ interface B : A interface C : A @Suppress("INVISIBLE_REFERENCE") -fun select(x: K, y: K): @kotlin.internal.Exact K = x +fun select(x: K, y: K): @kotlin.internal.Exact K = x fun foo(a: Any) {} diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation.fir.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation.fir.kt index b5ee5094fca..664de2117a5 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation.fir.kt @@ -6,7 +6,7 @@ interface ISample fun elvisSimple(x: K?, y: K): K = y @Suppress("INVISIBLE_REFERENCE") -fun elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y +fun elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y fun materialize(): T? = TODO() diff --git a/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation_ni.fir.kt b/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation_ni.fir.kt index 0b352bb01f2..b57495007af 100644 --- a/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation_ni.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/commonSystem/postponedCompletionWithExactAnnotation_ni.fir.kt @@ -6,7 +6,7 @@ interface ISample fun elvisSimple(x: K?, y: K): K = y @Suppress("INVISIBLE_REFERENCE") -fun elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y +fun elvisExact(x: K?, y: K): @kotlin.internal.Exact K = y fun materialize(): T? = null fun Any?.materialize(): T = null as T diff --git a/compiler/testData/diagnostics/tests/inference/completion/withExact.fir.kt b/compiler/testData/diagnostics/tests/inference/completion/withExact.fir.kt index c8e5dfb8245..cdee482a7ef 100644 --- a/compiler/testData/diagnostics/tests/inference/completion/withExact.fir.kt +++ b/compiler/testData/diagnostics/tests/inference/completion/withExact.fir.kt @@ -6,7 +6,7 @@ import kotlin.internal.Exact class Inv(val arg: I) -class InvExact(val arg: @kotlin.internal.Exact E) +class InvExact(val arg: @kotlin.internal.Exact E) interface Base class Derived : Base diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.fir.kt new file mode 100644 index 00000000000..f89a568e907 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.fir.kt @@ -0,0 +1,20 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER + +// FILE: Foo.java + +public class Foo { + public static void create(java.util.Map m) { return null; } +} + +// FILE: test.kt + +fun test(properties: Map, nullableProperties: Map?) { + val f1 = Foo.create(select1(properties, myEmptyMap())) + val f2 = Foo.create(nullableProperties ?: myEmptyMap()) +} + +fun myEmptyMap(): Map = TODO() + +@Suppress("INVISIBLE_REFERENCE") +fun select1(x: S, y: S): @kotlin.internal.Exact S = y diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.kt index 3cd187206dc..207fe35b53b 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/inference/elvisOperatorAgainstFlexibleType.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER @@ -18,4 +17,4 @@ fun test(properties: Map, nullableProperties: Map myEmptyMap(): Map = TODO() @Suppress("INVISIBLE_REFERENCE") -fun select1(x: S, y: S): @kotlin.internal.Exact S = y \ No newline at end of file +fun select1(x: S, y: S): @kotlin.internal.Exact S = y diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.fir.kt new file mode 100644 index 00000000000..a2b51bc98b2 --- /dev/null +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.fir.kt @@ -0,0 +1,30 @@ +//!DIAGNOSTICS: -UNUSED_PARAMETER + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +fun Iterable<*>.filterIsInstance1(): List<@kotlin.internal.NoInfer R> = throw Exception() + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +fun List<*>.filterIsInstance2(): @kotlin.internal.NoInfer List = throw Exception() + +fun test(list: List) { + list.filterIsInstance1().map { it * 2 } + list.filterIsInstance2().filter { it > 10 } +} + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +fun foo(t: R): List<@kotlin.internal.NoInfer R> = throw Exception("$t") + +fun test() { + foo(1).map { it * 2 } +} + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +fun List.foo(): @kotlin.internal.NoInfer R = throw Exception() + +@Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") +fun bar(r: R, f: Function1<@kotlin.internal.NoInfer R, Unit>): Nothing = throw Exception() + +fun test1() { + listOf("").foo().length + bar(1) { x -> x + 1 } +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt index b443e8019de..589abfaac12 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/internalAnnotationsOnTypes.kt @@ -1,4 +1,3 @@ -// FIR_IDENTICAL //!DIAGNOSTICS: -UNUSED_PARAMETER @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") @@ -28,4 +27,4 @@ fun bar(r: R, f: Function1<@kotlin.internal.NoInfer R, Unit>): Nothing = thr fun test1() { listOf("").foo().length bar(1) { x -> x + 1 } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.fir.kt index e7b0720908d..e871f7f9a22 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAndLowPriority.fir.kt @@ -7,7 +7,7 @@ public fun Iterable.contains1(element: T): Int = null!! @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -public fun Iterable.contains1(element: @kotlin.internal.NoInfer T): Boolean = null!! +public fun Iterable.contains1(element: @kotlin.internal.NoInfer T): Boolean = null!! fun test() { diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.fir.kt index e1de728cd58..23127817482 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/noInferAnnotation.fir.kt @@ -2,13 +2,13 @@ // !WITH_NEW_INFERENCE @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -fun test1(t1: T, t2: @kotlin.internal.NoInfer T): T = t1 +fun test1(t1: T, t2: @kotlin.internal.NoInfer T): T = t1 @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -fun @kotlin.internal.NoInfer T.test2(t1: T): T = t1 +fun @kotlin.internal.NoInfer T.test2(t1: T): T = t1 @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -fun test3(t1: @kotlin.internal.NoInfer T): T = t1 +fun test3(t1: @kotlin.internal.NoInfer T): T = t1 fun usage() { test1(1, "312") @@ -17,7 +17,7 @@ fun usage() { } @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -fun List.contains1(e: @kotlin.internal.NoInfer T): Boolean = true +fun List.contains1(e: @kotlin.internal.NoInfer T): Boolean = true fun test(i: Int?, a: Any, l: List) { l.contains1(a) @@ -26,7 +26,7 @@ fun test(i: Int?, a: Any, l: List) { } @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") -fun assertEquals1(e1: T, e2: @kotlin.internal.NoInfer T): Boolean = true +fun assertEquals1(e1: T, e2: @kotlin.internal.NoInfer T): Boolean = true fun test(s: String) { assertEquals1(s, 11) diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt index 26ef1f47754..72014270ae5 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.kt @@ -2,7 +2,7 @@ // !DIAGNOSTICS: -UNUSED_PARAMETER private object TopLevelTypeVariable { - @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN") fun foo(): @kotlin.internal.NoInfer T = TODO() fun bar(k: K) {} @@ -15,7 +15,7 @@ private object TopLevelTypeVariable { private object NestedTypeVariable { class Inv - @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE") + @Suppress("INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN") fun foo(): Inv<@kotlin.internal.NoInfer T> = TODO() fun bar(p: Inv) {} @@ -23,4 +23,4 @@ private object NestedTypeVariable { fun test() { bar(foo()) } -} \ No newline at end of file +} diff --git a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.txt b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.txt index a241563812e..6be210e8a61 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/inference/annotationsForResolve/propagationOfNoInferAnnotation.txt @@ -4,7 +4,7 @@ private object NestedTypeVariable { private constructor NestedTypeVariable() public final fun bar(/*0*/ p: NestedTypeVariable.Inv): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - @kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public final fun foo(): NestedTypeVariable.Inv + @kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN"}) public final fun foo(): NestedTypeVariable.Inv public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public final fun test(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String @@ -21,7 +21,7 @@ private object TopLevelTypeVariable { private constructor TopLevelTypeVariable() public final fun bar(/*0*/ k: K): kotlin.Unit public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean - @kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE"}) public final fun foo(): T + @kotlin.Suppress(names = {"INVISIBLE_MEMBER", "INVISIBLE_REFERENCE", "HIDDEN"}) public final fun foo(): T public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public final fun test(): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.fir.kt index cbd6e2b7360..c4540a6889d 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.fir.kt @@ -2,6 +2,6 @@ @Target(AnnotationTarget.TYPE) annotation class Ann(val x: Int) -fun case_1(x: String): @Ann(unresolved_reference) String { +fun case_1(x: String): @Ann(unresolved_reference) String { return x } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.fir.kt index c673f5976a5..3eb92eadf7a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.fir.kt @@ -5,4 +5,4 @@ @Target(AnnotationTarget.TYPE) annotation class Ann(val x: Int) -abstract class Foo : @Ann(unresolved_reference) Any() +abstract class Foo : @Ann(unresolved_reference) Any() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.fir.kt index 91c78d22399..b8ec19d447f 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.fir.kt @@ -8,7 +8,7 @@ annotation class Ann(val x: Int) fun foo(i: Inv<@Ann(unresolved_reference) String>) {} // TESTCASE NUMBER: 2 -fun test(vararg a: @Ann(unresolved_reference) Any) {} +fun test(vararg a: @Ann(unresolved_reference) Any) {} // TESTCASE NUMBER: 3 -class A(a: @Ann(unresolved_reference) T) +class A(a: @Ann(unresolved_reference) T) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt index b826b3ac3e3..e1342e91f10 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.fir.kt @@ -3,7 +3,7 @@ annotation class Ann(val x: Int) // TESTCASE NUMBER: 1 -abstract class Bar +abstract class Barunresolved_reference) Any> /* * TESTCASE NUMBER: 2 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.fir.kt index cb772bb1869..88f1d452c1b 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.fir.kt @@ -10,7 +10,7 @@ annotation class Ann(val x: Int) * UNEXPECTED BEHAVIOUR */ fun case_1(a: Any) { - if (a is @Ann(unresolved_reference) String) return + if (a is @Ann(unresolved_reference) String) return } /* @@ -18,7 +18,7 @@ fun case_1(a: Any) { * UNEXPECTED BEHAVIOUR */ fun case_2(a: Any) { - a as @Ann(unresolved_reference) String // OK, no error in IDE and in the compiler + a as @Ann(unresolved_reference) String // OK, no error in IDE and in the compiler } /* @@ -28,10 +28,10 @@ fun case_2(a: Any) { fun case_3_1(a: Any) {} fun case_3_2(a: Any) { - case_3_1(a as @Ann(unresolved_reference) String) // OK, no error in IDE and in the compiler + case_3_1(a as @Ann(unresolved_reference) String) // OK, no error in IDE and in the compiler } // TESTCASE NUMBER: 4 fun case_4(a: Any) { - val x = a as @Ann(unresolved_reference) String // ERROR, has error in IDE and in the compiler + val x = a as @Ann(unresolved_reference) String // ERROR, has error in IDE and in the compiler } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.fir.kt index 44b1e9dee4e..73f8301e2e2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.fir.kt @@ -18,4 +18,4 @@ val case_1 = object : TypeToken<@Ann(unresolved_reference) String>() {} */ interface A -val case_2 = object: @Ann(unresolved_reference) A {} +val case_2 = object: @Ann(unresolved_reference) A {} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.fir.kt index ea0459a48b9..db0b8962d0a 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.fir.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.fir.kt @@ -9,4 +9,4 @@ annotation class Ann var T.test get() = 11 - set(value: @Ann(unresolved_reference) Int) {} + set(value: @Ann(unresolved_reference) Int) {}