diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt index 17241c57930..bab102be7e6 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.fir.kt @@ -1,11 +1,14 @@ // !LANGUAGE: -ClassTypeParameterAnnotations +@Target(AnnotationTarget.TYPE_PARAMETER) annotation class A1 + +@Target(AnnotationTarget.TYPE_PARAMETER) annotation class A2(val some: Int = 12) -class TopLevelClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { - class InnerClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { +class TopLevelClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { + class InnerClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { fun test() { - class InFun<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> + class InFun<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> } } -} +} \ No newline at end of file diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt index 23ec252f7c6..8d2208febbe 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.kt @@ -1,11 +1,14 @@ // !LANGUAGE: -ClassTypeParameterAnnotations +@Target(AnnotationTarget.TYPE_PARAMETER) annotation class A1 + +@Target(AnnotationTarget.TYPE_PARAMETER) annotation class A2(val some: Int = 12) -class TopLevelClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { - class InnerClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { +class TopLevelClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { + class InnerClass<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> { fun test() { - class InFun<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> + class InFun<@A1 @A2(3) @A2 @A1(12) @A2("Test") T> } } } diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.txt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.txt index d3aa6c01a54..46719c8d252 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.txt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_15.txt @@ -1,13 +1,13 @@ package -public final annotation class A1 : kotlin.Annotation { +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) public final annotation class A1 : kotlin.Annotation { public constructor A1() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final annotation class A2 : kotlin.Annotation { +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE_PARAMETER}) public final annotation class A2 : kotlin.Annotation { public constructor A2(/*0*/ some: kotlin.Int = ...) public final val some: kotlin.Int public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt index 82f7743c77b..a4c7e2a8668 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.fir.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions +// !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions -ClassTypeParameterAnnotations annotation class A1 annotation class A2(val some: Int = 12) diff --git a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt index 24b3dab12f1..f711b91f718 100644 --- a/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt +++ b/compiler/testData/diagnostics/tests/annotations/AnnotationForClassTypeParameter_typeUseFlag.kt @@ -1,4 +1,4 @@ -// !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions +// !LANGUAGE: +ProperCheckAnnotationsTargetInTypeUsePositions -ClassTypeParameterAnnotations annotation class A1 annotation class A2(val some: Int = 12) diff --git a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt index fb3c9f567f8..c34c0bf809c 100644 --- a/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt +++ b/compiler/testData/diagnostics/tests/annotations/annotationOnParameterInFunctionType.kt @@ -12,7 +12,7 @@ fun inParamNested(fn1: (fn2: (@Ann n: Int)->Unit)->Unit) {} fun inReturn(): (@Ann x: Int)->Unit = {} -class A : (@Ann Int)->Unit { +class A : (@Ann Int)->Unit { override fun invoke(p1: Int) { var lambda: (@Ann x: Int)->Unit = {} } diff --git a/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.txt b/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.txt index 0451082b357..d6537911f37 100644 --- a/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.txt +++ b/compiler/testData/diagnostics/tests/functionLiterals/kt11733_1.txt @@ -6,6 +6,6 @@ public fun process(/*0*/ x: Predicate): kotlin.Unit public interface Predicate { public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int - public abstract operator fun invoke(/*0*/ @org.jetbrains.annotations.NotNull t: T): kotlin.Boolean + public abstract operator fun invoke(/*0*/ @org.jetbrains.annotations.NotNull t: T!!): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.fir.kt deleted file mode 100644 index 5b01943415f..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.fir.kt +++ /dev/null @@ -1,35 +0,0 @@ -// !USE_EXPERIMENTAL: kotlin.RequiresOptIn -// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE - -@file:OptIn(ExperimentalTypeInference::class) - -import kotlin.experimental.ExperimentalTypeInference - -class GenericController { - suspend fun yield(t: T) {} - fun notYield(t: T) {} - - suspend fun yieldBarReturnType(t: T) = t - fun barReturnType(): T = TODO() -} - -fun generate(@BuilderInference g: suspend GenericController.() -> Unit): List = TODO() - -val test1 = generate { - yield(3) -} - -val test2 = generate { - yield(3) - notYield(3) -} - -val test3 = generate { - yield(3) - yieldBarReturnType(3) -} - -val test4 = generate { - yield(3) - barReturnType() -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt index ad418bef64b..5c2b02a9e4a 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/incorrectCallsWithRestrictions.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !USE_EXPERIMENTAL: kotlin.RequiresOptIn // !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE @@ -24,12 +25,12 @@ val test2 = generate { notYield(3) } -val test3 = generate { +val test3 = generate { yield(3) yieldBarReturnType(3) } -val test4 = generate { +val test4 = generate { yield(3) barReturnType() } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.fir.kt deleted file mode 100644 index f56fe7ef2d5..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.fir.kt +++ /dev/null @@ -1,38 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// ALLOW_KOTLIN_PACKAGE -// !WITH_NEW_INFERENCE -// FILE: annotation.kt - -package kotlin - -annotation class BuilderInference - -// FILE: test.kt - -class Builder { - fun add(t: T) {} -} - -fun build(@BuilderInference g: Builder.() -> Unit): List = TODO() -fun wrongBuild(g: Builder.() -> Unit): List = TODO() - -fun Builder.extensionAdd(s: S) {} - -@BuilderInference -fun Builder.safeExtensionAdd(s: S) {} - -val member = build { - add(42) -} - -val memberWithoutAnn = wrongBuild { - add(42) -} - -val extension = build { - extensionAdd("foo") -} - -val safeExtension = build { - safeExtensionAdd("foo") -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt index 08c3e7e8456..e054470c1f0 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // ALLOW_KOTLIN_PACKAGE // !WITH_NEW_INFERENCE @@ -25,11 +26,11 @@ val member = build { add(42) } -val memberWithoutAnn = wrongBuild { +val memberWithoutAnn = wrongBuild { add(42) } -val extension = build { +val extension = build { extensionAdd("foo") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.txt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.txt index 09f79370be6..4ba791ecafa 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.txt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/resolveUsualCallWithBuilderInferenceWithRestrictions.txt @@ -1,8 +1,6 @@ package -public val extension: [ERROR : Type for build { - extensionAdd("foo") -}] +public val extension: kotlin.collections.List public val member: kotlin.collections.List public val memberWithoutAnn: [ERROR : Type for wrongBuild { add(42) diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.fir.kt deleted file mode 100644 index 38b3a1c3982..00000000000 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.fir.kt +++ /dev/null @@ -1,33 +0,0 @@ -// !DIAGNOSTICS: -UNUSED_PARAMETER -// ALLOW_KOTLIN_PACKAGE - -// FILE: annotation.kt - -package kotlin - -annotation class BuilderInference - -// FILE: test.kt - -class GenericController { - suspend fun yield(t: T) {} -} - -suspend fun GenericController.extensionYield(s: S) {} - -@BuilderInference -suspend fun GenericController.safeExtensionYield(s: S) {} - -fun generate(@BuilderInference g: suspend GenericController.() -> Unit): List = TODO() - -val normal = generate { - yield(42) -} - -val extension = generate { - extensionYield("foo") -} - -val safeExtension = generate { - safeExtensionYield("foo") -} diff --git a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt index fa807333c5e..55334c1ea83 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/builderInference/useInferenceInformationFromExtensionWithRestrictions.kt @@ -1,3 +1,4 @@ +// FIR_IDENTICAL // !DIAGNOSTICS: -UNUSED_PARAMETER // ALLOW_KOTLIN_PACKAGE @@ -24,7 +25,7 @@ val normal = generate { yield(42) } -val extension = generate { +val extension = generate { extensionYield("foo") } diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.fir.kt index ec1c040f115..99d689f1c99 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.fir.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -SuspendFunctionAsSupertype // SKIP_TXT import kotlin.reflect.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.kt index 532c9f662e8..75b364b5cd7 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/kSuspendFunctionAsSupertype.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -SuspendFunctionAsSupertype // SKIP_TXT import kotlin.reflect.* diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.fir.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.fir.kt index ae7ec219bbd..0bf40e2e6b2 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.fir.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.fir.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -SuspendFunctionAsSupertype typealias Action = () -> Unit interface SAM { diff --git a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.kt b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.kt index 7cd102c794c..74ab2041fab 100644 --- a/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.kt +++ b/compiler/testData/diagnostics/testsWithStdLib/coroutines/suspendFunctionType/modifierApplicability.kt @@ -1,3 +1,4 @@ +// !LANGUAGE: -SuspendFunctionAsSupertype typealias Action = () -> Unit interface SAM {