diff --git a/compiler/tests-spec/build.gradle.kts b/compiler/tests-spec/build.gradle.kts index 07f6792559e..bad44a56600 100644 --- a/compiler/tests-spec/build.gradle.kts +++ b/compiler/tests-spec/build.gradle.kts @@ -27,7 +27,9 @@ val generateJsonTestsMap by generator("org.jetbrains.kotlin.spec.tasks.GenerateJ val remoteRunTests by task { val packagePrefix = "org.jetbrains.kotlin." val includeTests = setOf( - "checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Contracts*" + "checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Contracts*", + "checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Annotations*", + "codegen.BlackBoxCodegenTestSpecGenerated\$NotLinked\$Annotations*" ) workingDir = rootDir diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/1.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/1.kt new file mode 100644 index 00000000000..bfa94819897 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/1.kt @@ -0,0 +1,20 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 1 + * DESCRIPTION: Type annotations on return type with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann + +fun foo(x: String): @Ann(unresolved_reference) String { // OK, error only in IDE but not in the compiler + return x +} + +fun box(): String? { + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/10.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/10.kt new file mode 100644 index 00000000000..454a50531f7 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/10.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 10 + * DESCRIPTION: Type annotations on a lambda type with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +fun case_1(): Any { + val x: (Int) -> @Ann(unresolved_reference) Unit = {} // OK, no error in IDE and in the compiler + + return x +} + +fun case_2(): Any { + val x: (@Ann(unresolved_reference) Int) -> Unit = { a: Int -> println(a) } // OK, no error in IDE and in the compiler + + return x +} + +fun box(): String? { + val x = case_1() + val y = case_2() + + if (x == null) return null + if (y == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/11.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/11.kt new file mode 100644 index 00000000000..8071a4f9399 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/11.kt @@ -0,0 +1,47 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 11 + * DESCRIPTION: Type annotations with invalid target. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28449 + */ + +@Retention(AnnotationRetention.RUNTIME) +@Target(AnnotationTarget.PROPERTY_GETTER) +annotation class Ann(val x: Int) + +class Foo : @Ann(10) Any() + +class Bar + +fun case_3(a: Any): Int? { + return if (a is @Ann(10) String) 10 else null +} + +open class TypeToken + +val case_4 = object : TypeToken<@Ann(10) String>() {} + +fun case_5(a: Any): Any { + a as @Ann(10) Int + + return a +} + +fun box(): String? { + val x1 = Foo() + val x2 = Bar() + val x3 = case_3(".") + val x4 = case_4 + val x5 = case_5(10) + + if (x1 == null) return null + if (x2 == null) return null + if (x3 == null) return null + if (x4 == null) return null + if (x5 == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/2.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/2.kt new file mode 100644 index 00000000000..a179c9f58b1 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/2.kt @@ -0,0 +1,24 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 2 + * DESCRIPTION: Type annotations on supertypes with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +abstract class Foo : @Ann(unresolved_reference) Any() + +class Bar: Foo() + +fun box(): String? { + val x = Bar() + + if (x == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/3.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/3.kt new file mode 100644 index 00000000000..d7b7c38c0ff --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/3.kt @@ -0,0 +1,32 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 3 + * DESCRIPTION: Type annotations on parameter types with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +class Inv + +fun foo(i: Inv<@Ann(unresolved_reference) String>) {} + +fun bar(vararg a: @Ann(unresolved_reference) Any) {} + +class A(a: @Ann(unresolved_reference) T) + +fun box(): String? { + val x = foo(Inv()) + val y = bar(1, 2, 3) + val z = A(10) + + if (x == null) return null + if (y == null) return null + if (z == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/4.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/4.kt new file mode 100644 index 00000000000..abe5069081f --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/4.kt @@ -0,0 +1,25 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 4 + * DESCRIPTION: Type annotations on type arguments for a containing type of return type, with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +class Inv + +fun case_1(): Inv<@Ann(unresolved_reference) String> = TODO() + +fun box(): String? { + try { + val x = case_1() + if (x == null) return null + } catch (e: NotImplementedError) {} + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/5.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/5.kt new file mode 100644 index 00000000000..6701f484301 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/5.kt @@ -0,0 +1,28 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 5 + * DESCRIPTION: Type annotations on upper bounds with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +abstract class Barunresolved_reference) Any> + +class Foo : Bar() + +class B where @Ann(unresolved_reference) T : Number + +fun box(): String? { + val x = Foo() + val y = B() + + if (x == null) return null + if (y == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/6.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/6.kt new file mode 100644 index 00000000000..488742a1195 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/6.kt @@ -0,0 +1,38 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 6 + * DESCRIPTION: Type annotations inside type check and cast expression with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +fun case_1(a: Any): Int? { + return if (a is @Ann(unresolved_reference) String) 10 else null +} + +fun case_2(a: Any): Any { + return a as @Ann(unresolved_reference) String // OK, no error in IDE and in the compiler +} + +fun case_3_1(a: Any) = 10 + +fun case_3(a: Any): Any { + return case_3_1(a as @Ann(unresolved_reference) String) // OK, no error in IDE and in the compiler +} + +fun box(): String? { + val x = case_1(".") + val y = case_2(".") + val z = case_3(".") + + if (x == null) return null + if (y == null) return null + if (z == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/7.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/7.kt new file mode 100644 index 00000000000..34d8582ff85 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/7.kt @@ -0,0 +1,30 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 7 + * DESCRIPTION: Type annotations on a type in an anonymous object expression, with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann + +open class TypeToken + +val case_1 = object : TypeToken<@Ann(unresolved_reference) String>() {} + +interface A + +val case_2 = object: @Ann(unresolved_reference) A {} + +fun box(): String? { + val x = case_1 + val y = case_2 + + if (x == null) return null + if (y == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/8.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/8.kt new file mode 100644 index 00000000000..a1d7f624f52 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/8.kt @@ -0,0 +1,28 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 8 + * DESCRIPTION: Type annotations on a receiver type (for an extension property only), with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +val @Ann(unresolved_reference) T.test // OK, error only in IDE but not in the compiler + get() = 10 + +val @Ann(unresolved_reference) Int.test + get() = 10 + +fun box(): String? { + val x = 10.test + val y = '.'.test + + if (x == null) return null + if (y == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/9.kt b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/9.kt new file mode 100644 index 00000000000..fbb06370517 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/9.kt @@ -0,0 +1,27 @@ +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 9 + * DESCRIPTION: Type annotations on a setter argument type with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +@Target(AnnotationTarget.TYPE) +annotation class Ann + +var T.test + get() = 11 + set(value: @Ann(unresolved_reference) Int) {} + +fun box(): String? { + val x = 10.test + 10.test = 11 + val y = 10.test + + if (x == null) return null + if (y == null) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.kt new file mode 100644 index 00000000000..39f30453daa --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.kt @@ -0,0 +1,16 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 1 + * DESCRIPTION: Type annotations on return type with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1 +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +fun case_1(x: String): @Ann(unresolved_reference) String { + return x +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.txt new file mode 100644 index 00000000000..7b1c8f73255 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.txt @@ -0,0 +1,11 @@ +package + +public fun case_1(/*0*/ x: kotlin.String): @Ann kotlin.String + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/10.kt new file mode 100644 index 00000000000..ec4a7394895 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/10.kt @@ -0,0 +1,35 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 10 + * DESCRIPTION: Type annotations on a lambda type with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1, 2 +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +fun case_1() { + val x: (Int) -> @Ann(unresolved_reference) Unit = {} // OK, no error in IDE and in the compiler +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + */ +fun case_2() { + val x: (@Ann(unresolved_reference) Int) -> Unit = { a: Int -> println(a) } // OK, no error in IDE and in the compiler +} + +// TESTCASE NUMBER: 3 +fun case_3() { + val x: (@Ann(unresolved_reference) Int) -> Unit = { a -> println(a) } // ERROR (if argument type isn't specified explicitly) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/10.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/10.txt new file mode 100644 index 00000000000..a6c0069f452 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/10.txt @@ -0,0 +1,13 @@ +package + +public fun case_1(): kotlin.Unit +public fun case_2(): kotlin.Unit +public fun case_3(): kotlin.Unit + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/11.kt new file mode 100644 index 00000000000..1da41c29e2c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/11.kt @@ -0,0 +1,35 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 11 + * DESCRIPTION: Type annotations with invalid target. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28449 + */ + +// TESTCASE NUMBER: 1, 2, 3, 4, 5 +@Retention(AnnotationRetention.RUNTIME) +@Target(AnnotationTarget.PROPERTY_GETTER) +annotation class Ann(val x: Int) + +// TESTCASE NUMBER: 1 +abstract class Foo : @Ann(10) Any() + +// TESTCASE NUMBER: 2 +abstract class Bar + +// TESTCASE NUMBER: 3 +fun case_3(a: Any) { + if (a is @Ann(10) String) return +} + +// TESTCASE NUMBER: 4 +open class TypeToken + +val case_4 = object : TypeToken<@Ann(10) String>() {} + +// TESTCASE NUMBER: 5 +fun case_5(a: Any) { + a as @Ann(10) Int +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/11.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/11.txt new file mode 100644 index 00000000000..41327d85812 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/11.txt @@ -0,0 +1,34 @@ +package + +public val case_4: TypeToken<@Ann(x = 10) kotlin.String> +public fun case_3(/*0*/ a: kotlin.Any): kotlin.Unit +public fun case_5(/*0*/ a: kotlin.Any): kotlin.Unit + +@kotlin.annotation.Retention(value = AnnotationRetention.RUNTIME) @kotlin.annotation.Target(allowedTargets = {AnnotationTarget.PROPERTY_GETTER}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 abstract class Bar { + public constructor Bar() + 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 abstract class Foo { + public constructor Foo() + 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 open class TypeToken { + public constructor TypeToken() + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt new file mode 100644 index 00000000000..376f3965e61 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt @@ -0,0 +1,17 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 2 + * DESCRIPTION: Type annotations on supertypes with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +abstract class Foo : @Ann(unresolved_reference) Any() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.txt new file mode 100644 index 00000000000..35a069e5a43 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.txt @@ -0,0 +1,16 @@ +package + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 abstract class Foo { + public constructor Foo() + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt new file mode 100644 index 00000000000..63ce8bc6073 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt @@ -0,0 +1,26 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 3 + * DESCRIPTION: Type annotations on parameter types with unresolved reference in parameters. + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1, 2, 3 +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +// TESTCASE NUMBER: 1 +class Inv + +fun foo(i: Inv<@Ann(unresolved_reference) String>) {} + +// TESTCASE NUMBER: 2 +fun test(vararg a: @Ann(unresolved_reference) Any) {} + +// TESTCASE NUMBER: 3 +class A(a: @Ann(unresolved_reference) T) diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.txt new file mode 100644 index 00000000000..bf84feedf72 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.txt @@ -0,0 +1,26 @@ +package + +public fun foo(/*0*/ i: Inv<@Ann kotlin.String>): kotlin.Unit +public fun test(/*0*/ vararg a: @Ann kotlin.Any /*kotlin.Array*/): kotlin.Unit + +public final class A { + public constructor A(/*0*/ a: @Ann T) + 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 +} + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 class Inv { + public constructor Inv() + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt new file mode 100644 index 00000000000..67d49a5f005 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt @@ -0,0 +1,16 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 4 + * DESCRIPTION: Type annotations on type arguments for a containing type of return type, with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1 +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +class Inv + +fun case_1(): Inv<@Ann(unresolved_reference) String> = TODO() diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.txt new file mode 100644 index 00000000000..e642b39cb3a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.txt @@ -0,0 +1,18 @@ +package + +public fun case_1(): Inv<@Ann kotlin.String> + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 class Inv { + public constructor Inv() + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.kt new file mode 100644 index 00000000000..33e40f37135 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.kt @@ -0,0 +1,21 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 5 + * DESCRIPTION: Type annotations on upper bounds with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1, 2 +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +// TESTCASE NUMBER: 1 +abstract class Barunresolved_reference) Any> + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + */ +class B where @Ann(unresolved_reference) T : Number diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.txt new file mode 100644 index 00000000000..19fbc113899 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.txt @@ -0,0 +1,23 @@ +package + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 class B { + public constructor B() + 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 abstract class Bar { + public constructor Bar() + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt new file mode 100644 index 00000000000..de448b64983 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt @@ -0,0 +1,45 @@ +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_PARAMETER + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 6 + * DESCRIPTION: Type annotations inside type check and cast expression with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1, 2 +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +fun case_1(a: Any) { + if (a is @Ann(unresolved_reference) String) return +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + */ +fun case_2(a: Any) { + a as @Ann(unresolved_reference) String // OK, no error in IDE and in the compiler +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + */ +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 +} + +// 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.txt new file mode 100644 index 00000000000..7d2a5ddca22 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.txt @@ -0,0 +1,15 @@ +package + +public fun case_1(/*0*/ a: kotlin.Any): kotlin.Unit +public fun case_2(/*0*/ a: kotlin.Any): kotlin.Unit +public fun case_3_1(/*0*/ a: kotlin.Any): kotlin.Unit +public fun case_3_2(/*0*/ a: kotlin.Any): kotlin.Unit +public fun case_4(/*0*/ a: kotlin.Any): kotlin.Unit + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.kt new file mode 100644 index 00000000000..d2ecc5ddd62 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.kt @@ -0,0 +1,28 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 7 + * DESCRIPTION: Type annotations on a type in an anonymous object expression, with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1, 2 +@Target(AnnotationTarget.TYPE) +annotation class Ann + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +open class TypeToken + +val case_1 = object : TypeToken<@Ann(unresolved_reference) String>() {} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + */ +interface A + +val case_2 = object: @Ann(unresolved_reference) A {} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.txt new file mode 100644 index 00000000000..7fb2f310c33 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.txt @@ -0,0 +1,24 @@ +package + +public val case_1: TypeToken<@Ann kotlin.String> +public val case_2: @Ann A + +public interface A { + 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 +} + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann() + 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 open class TypeToken { + public constructor TypeToken() + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/8.kt new file mode 100644 index 00000000000..c33a4d7471c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/8.kt @@ -0,0 +1,20 @@ +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 8 + * DESCRIPTION: Type annotations on a receiver type (for an extension property only), with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +// TESTCASE NUMBER: 1, 2 +@Target(AnnotationTarget.TYPE) +annotation class Ann(val x: Int) + +// TESTCASE NUMBER: 1 +val @Ann(unresolved_reference) T.test // OK, error only in IDE but not in the compiler + get() = 10 + +// TESTCASE NUMBER: 2 +val @Ann(unresolved_reference) Int.test + get() = 10 diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/8.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/8.txt new file mode 100644 index 00000000000..673cfd06903 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/8.txt @@ -0,0 +1,12 @@ +package + +public val @Ann T.test: kotlin.Int +public val @Ann kotlin.Int.test: kotlin.Int + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann(/*0*/ x: kotlin.Int) + public final val x: kotlin.Int + 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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.kt new file mode 100644 index 00000000000..5ac5cfe9a62 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.kt @@ -0,0 +1,21 @@ +// !DIAGNOSTICS: -UNUSED_PARAMETER + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: annotations, type-annotations + * NUMBER: 9 + * DESCRIPTION: Type annotations on a setter argument type with unresolved reference in parameters. + * ISSUES: KT-28424 + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + */ +@Target(AnnotationTarget.TYPE) +annotation class Ann + +var T.test + get() = 11 + set(value: @Ann(unresolved_reference) Int) {} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.txt b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.txt new file mode 100644 index 00000000000..c0bd97be7d2 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.txt @@ -0,0 +1,10 @@ +package + +public var T.test: kotlin.Int + +@kotlin.annotation.Target(allowedTargets = {AnnotationTarget.TYPE}) public final annotation class Ann : kotlin.Annotation { + public constructor Ann() + 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 +} diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java index 503dbd05272..1a44ace7ca3 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java @@ -1359,6 +1359,100 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/notLinked"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); } + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/annotations") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Annotations extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInAnnotations() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/notLinked/annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Type_annotations extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInType_annotations() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.kt") + public void test1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/1.kt"); + } + + @TestMetadata("10.kt") + public void test10() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/10.kt"); + } + + @TestMetadata("11.kt") + public void test11() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/11.kt"); + } + + @TestMetadata("2.kt") + public void test2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/2.kt"); + } + + @TestMetadata("3.kt") + public void test3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/3.kt"); + } + + @TestMetadata("4.kt") + public void test4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/4.kt"); + } + + @TestMetadata("5.kt") + public void test5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/5.kt"); + } + + @TestMetadata("6.kt") + public void test6() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/6.kt"); + } + + @TestMetadata("7.kt") + public void test7() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/7.kt"); + } + + @TestMetadata("8.kt") + public void test8() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/8.kt"); + } + + @TestMetadata("9.kt") + public void test9() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg/9.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/notLinked/annotations/type-annotations/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/contracts") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java index e3b8f788705..87e548e9ad1 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java @@ -634,4 +634,111 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class NotLinked extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInNotLinked() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Annotations extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInAnnotations() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Type_annotations extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInType_annotations() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.kt") + public void test1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/1.kt"); + } + + @TestMetadata("10.kt") + public void test10() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/10.kt"); + } + + @TestMetadata("11.kt") + public void test11() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/11.kt"); + } + + @TestMetadata("2.kt") + public void test2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/2.kt"); + } + + @TestMetadata("3.kt") + public void test3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/3.kt"); + } + + @TestMetadata("4.kt") + public void test4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/4.kt"); + } + + @TestMetadata("5.kt") + public void test5() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/5.kt"); + } + + @TestMetadata("6.kt") + public void test6() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/6.kt"); + } + + @TestMetadata("7.kt") + public void test7() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/7.kt"); + } + + @TestMetadata("8.kt") + public void test8() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/8.kt"); + } + + @TestMetadata("9.kt") + public void test9() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg/9.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + } + } + } + } }