From 4819223b74537521c2b3193a18f5d5990ccfcd8d Mon Sep 17 00:00:00 2001 From: "victor.petukhov" Date: Tue, 25 Sep 2018 13:07:36 +0300 Subject: [PATCH] Add generated codegen box tests for Boolean literals as identifiers --- .../boolean-literals/p-1/pos/2.1.kt | 44 ++++ .../boolean-literals/p-1/pos/2.10.kt | 33 +++ .../boolean-literals/p-1/pos/2.11.kt | 42 ++++ .../boolean-literals/p-1/pos/2.12.kt | 46 ++++ .../boolean-literals/p-1/pos/2.13.kt | 121 ++++++++++ .../boolean-literals/p-1/pos/2.14.kt | 59 +++++ .../boolean-literals/p-1/pos/2.15.kt | 40 ++++ .../boolean-literals/p-1/pos/2.16.kt | 30 +++ .../boolean-literals/p-1/pos/2.17.kt | 34 +++ .../boolean-literals/p-1/pos/2.18.kt | 28 +++ .../boolean-literals/p-1/pos/2.19.kt | 57 +++++ .../boolean-literals/p-1/pos/2.2.kt | 35 +++ .../boolean-literals/p-1/pos/2.20.kt | 23 ++ .../boolean-literals/p-1/pos/2.21.kt | 33 +++ .../boolean-literals/p-1/pos/2.22.kt | 51 ++++ .../boolean-literals/p-1/pos/2.23.kt | 31 +++ .../boolean-literals/p-1/pos/2.24.kt | 44 ++++ .../boolean-literals/p-1/pos/2.25.kt | 28 +++ .../boolean-literals/p-1/pos/2.26.kt | 38 +++ .../boolean-literals/p-1/pos/2.3.kt | 65 +++++ .../boolean-literals/p-1/pos/2.4.kt | 29 +++ .../boolean-literals/p-1/pos/2.5.kt | 20 ++ .../boolean-literals/p-1/pos/2.6.kt | 20 ++ .../boolean-literals/p-1/pos/2.7.kt | 25 ++ .../boolean-literals/p-1/pos/2.8.kt | 28 +++ .../boolean-literals/p-1/pos/2.9.kt | 63 +++++ .../BlackBoxCodegenTestSpecGenerated.java | 226 ++++++++++++++++++ .../kotlin/spec/tasks/GenerateSpecTests.kt | 4 + 28 files changed, 1297 insertions(+) create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.19.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.20.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.21.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.22.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.23.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.24.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.25.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.7.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.8.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt create mode 100644 compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt new file mode 100644 index 00000000000..d7a9e38330b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt @@ -0,0 +1,44 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 1 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +open class `true` { + val x1 = true +} + +internal open class A: `true`() { + val x2 = false +} + +annotation class `false`(val x2: Boolean) + +@`false`(false) internal class B: @`false`(false) A() {} + +@`false`(true) interface C + +fun box(): String? { + val o1 = `true`() + val o2 = A() + val o3 = B() + + if (o1.x1 != true) return null + if (o2.x1 != true || o2.x2 != false || o3.x2 != false || o3.x1 != true) return null + + if (!checkAnnotation("B", "false")) return null + if (!checkAnnotation("C", "false")) return null + if (!checkSuperClass(B::class, "A")) return null + if (!checkSuperTypeAnnotation(B::class, "A", "false")) return null + if (!checkClassName(`false`::class, "false")) return null + if (!checkClassName(`true`::class, "true")) return null + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt new file mode 100644 index 00000000000..e93bdfe8a86 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt @@ -0,0 +1,33 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 10 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the companionObject. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +package org.jetbrains.`true` + +open class A { + companion object `false` { + + } +} + +class B { + companion object `true`: A() { + + } +} + +fun box(): String? { + if (!checkCompanionObjectName(A::class, "org.jetbrains.true.A.false")) return null + if (!checkCompanionObjectName(B::class, "org.jetbrains.true.B.true")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt new file mode 100644 index 00000000000..3c4d1a27677 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt @@ -0,0 +1,42 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 11 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the function. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +fun `true`(): Boolean { + return true +} + +fun Boolean.`false`() = true + +fun T.`true`() = listOf(0).`false`() + +inline fun K?.`false`(x1: T = 10 as T) + where K : List, + K : Iterable, + T : Comparable, + T : Number = false + +fun box(): String? { + if (!`true`()) return null + if (null.`false`>()) return null + if (false.`true`()) return null + if (!false.`false`()) return null + if (Any().`true`()) return null + + if (!checkFunctionName(::`true`, "true")) return null + if (!checkFunctionName(Boolean::`false`, "false")) return null + if (!checkFunctionName(Boolean::`true`, "true")) return null + if (!checkFunctionName(List::`false`, "false")) return null + if (!checkFunctionName(Nothing?::`true`, "true")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt new file mode 100644 index 00000000000..2207dbf3c14 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt @@ -0,0 +1,46 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 12 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the setter. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +class A { + var x1: String = "100" + set(`true`) { + field = "$`true` 10" + } +} + +object B { + var x2: String = "101" + set(`false`) = kotlin.Unit +} + +var x3: String = "102" + set(`true`) { + field = "${`true`} 11" + } + +fun box(): String? { + val a = A() + a.x1 = "0" + B.x2 = "1" + x3 = "2" + + if (a.x1 != "0 10") return null + if (B.x2 != "101") return null + if (x3 != "2 11") return null + + if (!checkSetterParameterName(A::x1, "true")) return null + if (!checkSetterParameterName(B::x2, "false")) return null + if (!checkSetterParameterName(::x3, "true")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt new file mode 100644 index 00000000000..ce04a6e3fa3 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt @@ -0,0 +1,121 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 13 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the simpleUserType. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +package org.jetbrains.`true` + +open class `false` +open class `true` + +typealias D<`false`> = `true`<`false`> + +inline fun f1() = + when (`false`()) { + is `true` -> true + is `false` -> false + else -> false + } + +inline fun > T.f2(value: T) = value is `false` + +class A>> { + val x = true +} + +class B>>> { + var x = false +} + +fun T.f3() = false + +fun f4(x1: List>): Boolean { + return true +} + +fun f5(x1: List>>) = false + +fun f6(x1: `false`) = false + +fun f7(x1: `true`<*>) = true + +fun f8(x1: `true`) = false + +fun f9(x1: `true`>>) = true + +val x1: List<`false`?> = listOf(`false`(), null, `false`()) + +lateinit var x2: List<`true`?> + +fun box(): String? { + x2 = listOf(`true`(), null, `true`()) + + if (!f1<`false`, `true`<`false`>>()) return null + if (`true`<`false`>().f2(`true`())) return null + if (!A>>().x) return null + if (B<`false`, A>>>().x) return null + if (`false`().f3()) return null + if (!f4(listOf(`true`()))) return null + if (f5(listOf(listOf(listOf(null, `false`(), null, `false`()))))) return null + if (f6(`false`())) return null + if (!f7(`true`())) return null + if (f8(`true`<`false`>())) return null + if (!f9(`true`>>())) return null + + if (x1.containsAll(listOf(`false`(), null, `false`()))) return null + if (x2.containsAll(listOf(`true`(), null, `true`()))) return null + + if (!checkCallableTypeParametersWithUpperBounds( + `true`<`false`>::f2, + listOf( + Pair("T", listOf("org.jetbrains.`true`.D /* = org.jetbrains.`true`.`true` */")) + ) + )) return null + + if (!checkClassTypeParametersWithUpperBounds( + A::class, + listOf( + Pair("K", listOf("kotlin.collections.List>")) + ) + )) return null + + if (!checkClassTypeParametersWithUpperBounds( + B::class, + listOf( + Pair("T", listOf("org.jetbrains.`true`.A>>")) + ) + )) return null + + if (!checkCallableTypeParametersWithUpperBounds( + `false`::f3, + listOf( + Pair("T", listOf("org.jetbrains.`true`.`false`")) + ) + )) return null + + if (!checkParameterType(::f4, "x1", "kotlin.collections.List>")) return null + + if (!checkParameterType(::f5, "x1", "kotlin.collections.List>>")) return null + + if (!checkPropertyType(::x1, "kotlin.collections.List")) return null + + if (!checkPropertyType(::x2, "kotlin.collections.List?>")) return null + + if (!checkParameterType(::f6, "x1", "org.jetbrains.`true`.`false`")) return null + + if (!checkParameterType(::f7, "x1", "org.jetbrains.`true`.`true`<*>")) return null + + if (!checkParameterType(::f8, "x1", "org.jetbrains.`true`.`true`")) return null + + if (!checkParameterType(::f9, "x1", "org.jetbrains.`true`.`true`>>")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt new file mode 100644 index 00000000000..8fa6c0fd5ab --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt @@ -0,0 +1,59 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 14 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeParameter. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +package org.jetbrains.`true` + +open class `false` { + val x1 = false +} +open class `true` { + val x1 = true +} + +typealias A<`false`> = `true`<`false`> + +class B<`true`, `false`> { + val x1: `true` = `true`<`false`>() as `true` + val x2: A<`false`> = `true`<`true`>() as A<`false`> + val x3: `false` = `false`() as `false` +} + +fun <`true`: Number> f1(): Boolean { + val x1: `true` = 10 as `true` + return false +} + +inline fun `false`.f2() = true + +val <`false`> `false`.x1: `true` + get() = `true`() + +fun box(): String? { + val b = B<`true`<`false`>, `false`>() + + if (!null.x1.x1) return null + if (!b.x1.x1 || !b.x2.x1 || b.x3.x1) return null + if (f1()) return null + if (!0.f2()) return null + if (!(-1).x1.x1) return null + + if (!checkCallableTypeParameter(Any::x1, "false")) return null + if (!checkClassTypeParameters(B::class, listOf("false", "true"))) return null + if (!checkTypeProperties(B::class, listOf( + Pair("x1", "`true`"), + Pair("x2", "org.jetbrains.`true`.A<`false`> /* = org.jetbrains.`true`.`true`<`false`> */"), + Pair("x3", "`false`") + ))) return null + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt new file mode 100644 index 00000000000..38cf71d975b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt @@ -0,0 +1,40 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 15 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the parameter. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +fun f1(`true`: Boolean) = !!!`true` +fun f2(`false`: Boolean, `true`: Boolean) = `false` && `true` +fun f3(`false`: Boolean, `true`: Boolean = `false`) = `false` || !`true` + +class A { + var x1: Boolean = false + set(`false`) { + field = !`false` + } +} + +fun box(): String? { + val a = A() + a.x1 = false + + if (f1(true)) return null + if (!f2(true, true)) return null + if (f3(false, true)) return null + if (!a.x1) return null + + if (!checkParameter(::f1, "true")) return null + if (!checkParameters(::f2, listOf("false", "true"))) return null + if (!checkParameters(::f3, listOf("false", "true"))) return null + if (!checkSetterParameterName(A::x1, "false")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt new file mode 100644 index 00000000000..50a000e93c4 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt @@ -0,0 +1,30 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 16 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationComplex. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +@file:[org.jetbrains.`true`.`false`() `true`] + +package org.jetbrains.`true` + +@Target(AnnotationTarget.FILE) +annotation class `false` + +@Target(AnnotationTarget.FILE) +annotation class `true` + +fun box(): String? { + if (!checkFileAnnotations("org.jetbrains.true._2_16Kt", listOf("org.jetbrains.true.false", "true"))) return null + if (!checkPackageName("org.jetbrains.true._2_16Kt", "org.jetbrains.true")) return null + if (!checkClassName(`false`::class, "org.jetbrains.true.false")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt new file mode 100644 index 00000000000..9f98b9b9449 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt @@ -0,0 +1,34 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 17 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the object. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +open class A { + val x1 = true +} + +final object `true` { + val x1 = false +} + +object `false` : A() { + val x2 = false +} + +fun box(): String? { + if (`true`.x1) return null + if (!`false`.x1 || `false`.x2) return null + + if (!checkClassName(`true`::class, "true")) return null + if (!checkClassName(`false`::class, "false")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt new file mode 100644 index 00000000000..5b441b72ca0 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt @@ -0,0 +1,28 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 18 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeAlias. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +typealias `true` = Boolean + +internal typealias `false`<`true`> = Map<`true`, List<`true`>?> + +fun box(): String? { + val x1: `false` = mapOf(true to listOf(false, false), false to null) + val x2: `true` = false + + if (!x1[true]!!.containsAll(listOf(false, false)) || x1[false] != null) return null + if (x2) return null + + if (!checkClassName(`true`::class, "kotlin.Boolean")) return null + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.19.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.19.kt new file mode 100644 index 00000000000..fcb4d7abe06 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.19.kt @@ -0,0 +1,57 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 19 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the import. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +// FILE: 2_19_1.kt + +package org.jetbrains.`true`.`false` + +val x1 = false + +// FILE: 2_19_2.kt + +val `true` = false + +// FILE: 2_19_3.kt + +package `false`; + +val x3 = true + +// FILE: 2_19_4.kt + +package `true` + +val x4 = false + +// FILE: 2_19_5.kt + +package org.jetbrains.kotlin + +val x5 = true + +// FILE: 2_19_6.kt + +val `false` = false + +// FILE: 2_19_7.kt + +package part_1 + +import org.jetbrains.`true`.`false`.* +import `true` +import `false`.*; +import `true`.*import `false` + +fun box(): String? { + if (x1 || `true` || !x3 || x4 || `false`) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.2.kt new file mode 100644 index 00000000000..df0fd688a7a --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.2.kt @@ -0,0 +1,35 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 2 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the labelReference. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +fun `true`() { + val l = `false`@ { + return@`false` + } + l() + return@`true` +} + +fun box(): String? { + `true`() + + var i = 0 + `false`@ while (i < 10) { + i++ + if (i <= 7) { + continue@`false` + } + if (i > 5) { + break@`false` + } + } + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.20.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.20.kt new file mode 100644 index 00000000000..f42d0ff5b70 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.20.kt @@ -0,0 +1,23 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 20 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the infixFunctionCall. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +infix fun Int.`true`(value: Int) = value > 100 + +infix fun Int.`false`(value: Int): Int { + return value - 90 +} + +fun box(): String? { + if (1 + 1 `true` -1001020) return null + if (1 + 1 `false` 2004 `true` -0) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.21.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.21.kt new file mode 100644 index 00000000000..718709990cc --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.21.kt @@ -0,0 +1,33 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 21 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the catchBlock. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +annotation class A + +fun box(): String? { + var value_1 = false + var value_2 = true + + try { + throw Exception() + } catch (`true`: Throwable) { + value_1 = true + } + + try { + throw Exception() + } catch (@A `false`: Throwable) { + value_2 = false + } + + if (!value_1 || value_2) return null + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.22.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.22.kt new file mode 100644 index 00000000000..443d8a1aa6a --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.22.kt @@ -0,0 +1,51 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 22 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the labelDefinition. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.EXPRESSION) +annotation class Foo + +fun box(): String? { + val lambda_1 = `true`@ { + return@`true` false + } + val lambda_2 = @Foo `false`@ { Boolean + return@`false` false + } + + val x1 = `true`@ true + + var i = 0 + + `false`@ while (true) { + i++ + if (i < 4) continue@`false` + i++ + if (i > 15) break@`false` + } + + var j = 0 + + `true`@ for (k in 0..20) { + j++ + if (k < 4) continue@`true` + j++ + if (k > 15) break@`true` + } + + if (lambda_1()) return null + if (lambda_2()) return null + if (!x1) return null + if (i != 17) return null + if (j != 30) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.23.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.23.kt new file mode 100644 index 00000000000..5d9a6688cdd --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.23.kt @@ -0,0 +1,31 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 23 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the atomicExpression. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +fun box(): String? { + val `true` = 10 + val `false` = "." + + val value_1 = `true` - 100 % `true` + val value_2 = `true`.dec() + val value_3 = "$`false` 10" + val value_4 = "${`false`}" + val value_5 = `false` + " 11..." + `false` + "1" + val value_6 = `true` + + if (value_1 != 10) return null + if (value_2 != 9) return null + if (value_3 != ". 10") return null + if (value_4 != ".") return null + if (value_5 != ". 11....1") return null + if (value_6 != 10) return null + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.24.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.24.kt new file mode 100644 index 00000000000..c559352e63b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.24.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 24 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the variableDeclarationEntry. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +val `true` = {`false`: Boolean -> !`false` } + +fun f1(value: Pair): Boolean { + val (`false`, `true`) = value + + if (`false` != "1") return false + if (`true` != "2") return false + + return true +} + +fun box(): String? { + var i = 0 + for (`false`: Int in 0..10) { + i++ + } + + if (!`true`(false)) return null + + val `true` = { `false`: Boolean, `true`: Int -> true } + var `false`: Boolean + + `false` = false + + if (!f1(Pair("1", "2"))) return null + if (i != 11) return null + if (!`true`(false, 10)) return null + if (`false`) return null + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.25.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.25.kt new file mode 100644 index 00000000000..bd27a9b132f --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.25.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 25 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the valueArgument. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +fun f1(`true`: Boolean, `false`: Boolean) = `true` && !!!`false` + +fun f2(`true`: Boolean): Boolean { + return !`true` +} + +fun f3(vararg `false`: Boolean, `true`: Boolean) = `false`.any { it } && `true` + +fun box(): String? { + if (f1(`true` = false, `false` = true)) return null + if (!f2(`true` = false && true || true && false)) return null + if (!f3(`false` = *booleanArrayOf(true, false, false, true), `true` = true)) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt new file mode 100644 index 00000000000..f6a7a4631ae --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt @@ -0,0 +1,38 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 26 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the callableReference. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +val Boolean.`true`: Boolean + get() { + return true + } + +val Boolean?.`false`: Boolean + get() { + return false + } + +fun Int?.`true`(x: Boolean): Boolean { + return !x +} + +fun box(): String? { + if (!false.`true` || false.`false` || !0.`true`(false)) return null + + if (!checkCallableName(Boolean::`true`, "true") || !Boolean::`true`.get(true)) return null + if (!checkCallableName(Boolean????::`false`, "false") || Boolean????::`false`.get(false)) return null + if (!checkCallableName(Boolean????::`false`::equals.call(false)::`true`, "true") + || !Boolean????::`false`::equals.call(false)::`true`.get()) return null + if (!checkCallableName(Int?::`true`, "true") || Int?::`true`.call(10, true)) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt new file mode 100644 index 00000000000..e9ca47db7b6 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt @@ -0,0 +1,65 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 3 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeConstraint. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +class A <`true`, `false`> + where `true` : CharSequence, + `false` : Comparable<`true`> { + fun getValue() = false +} + +annotation class B <`true`> + where `true` : CharSequence, + @A> `true` : Comparable<`true`> { + +} + +annotation class C <`false`, `true`> where @property:C `false` : CharSequence, `true` : Comparable<`true`> { + +} + +fun <`false`, `true`> d(): Boolean + where `false` : Any, + `false` : Iterable<*>, + `false` : Collection<*>, + `false` : MutableCollection<*>, + `true` : Comparable<`false`> = true + +fun box(): String? { + if (!d, Comparable>>()) return null + if (A().getValue()) return null + + if (!checkClassTypeParametersWithUpperBounds( + A::class, + listOf( + Pair("true", listOf("kotlin.CharSequence")), + Pair("false", listOf("kotlin.Comparable<`true`>")) + ) + )) return null + + if (!checkClassTypeParametersWithUpperBounds( + B::class, + listOf( + Pair("true", listOf("kotlin.CharSequence", "kotlin.Comparable<`true`>")) + ) + )) return null + + if (!checkClassTypeParametersWithUpperBounds( + C::class, + listOf( + Pair("false", listOf("kotlin.CharSequence")), + Pair("true", listOf("kotlin.Comparable<`true`>")) + ) + )) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt new file mode 100644 index 00000000000..7d3a07cd097 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt @@ -0,0 +1,29 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 4 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationSimple. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +@file:`true` +@file:`false` + +@Target(AnnotationTarget.FILE) +annotation class `true` + +@Target(AnnotationTarget.FILE) +annotation class `false` + +fun box(): String? { + if (!checkFileAnnotations("_2_4Kt", listOf("true", "false"))) return null + if (!checkClassName(`true`::class, "true")) return null + if (!checkClassName(`false`::class, "false")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt new file mode 100644 index 00000000000..47bd6b24e7c --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt @@ -0,0 +1,20 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 5 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageComplex. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +package org.jetbrains.`true` + +fun box(): String? { + if (!checkPackageName("org.jetbrains.true._2_5Kt", "org.jetbrains.true")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt new file mode 100644 index 00000000000..cd0d1007a99 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt @@ -0,0 +1,20 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 6 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageSimple. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +package `true` + +fun box(): String? { + if (!checkPackageName("true._2_6Kt", "true")) return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.7.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.7.kt new file mode 100644 index 00000000000..0b00ccce880 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.7.kt @@ -0,0 +1,25 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 7 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the enumEntry. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +enum class A(val x: Boolean) { + `true`(false), + `false`(true); +} + +fun box(): String? { + if (A.`true`.x) return null + if (!A.`false`.x) return null + + if (A.`true`.name != "true") return null + if (A.`false`.name != "false") return null + + return "OK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.8.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.8.kt new file mode 100644 index 00000000000..3062e7d5d4b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.8.kt @@ -0,0 +1,28 @@ +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 8 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the stringTemplateElement. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +fun box(): String? { + val `true` = "0" + val `false` = "1" + + val x1 = "${`false`}" + val x2 = "..." + "...$`true`..." + "..." + var x3 = "$`false`${`true`}$`false`" + + if (`false` != "1") return null + if (`true` != "0") return null + + if (x1 != "1") return null + if (x2 != "......0......") return null + if (x3 != "101") return null + + return "OK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt new file mode 100644 index 00000000000..fa1f379d09d --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt @@ -0,0 +1,63 @@ +// HELPERS: REFLECT + +/* + KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + + SECTIONS: constant-literals, boolean-literals + PARAGRAPH: 1 + SENTENCE: [2] These are strong keywords which cannot be used as identifiers unless escaped. + NUMBER: 9 + DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the unescapedAnnotation. + NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! + */ + +package org.jetbrains.`true` + +annotation class `false` + +annotation class `true` (val a: String) + +class A { + @field:`false` + val x1: Int = 0 + + @setparam:`false` + var x2: Int = 1 + + val @receiver:org.jetbrains.`true`.`true`>("false") String.x3: Int + get() { + return 2 + } + + @org.jetbrains.`true`.`true`("1") + val x4: Int = 3 + + @`false` + val x5: Int = 4 + + val x6: Int = "...".x3 +} + +@`false` val x6 = 5 + +@org.jetbrains.`true`.`true`<`false`>(".") fun f1() = false + +fun box(): String? { + val a = A() + + if (a.x1 != 0 || a.x2 != 1 || a.x6 != 2 || a.x4 != 3 || a.x5 != 4 || x6 != 5) return null + if (f1()) return null + + if (!checkProperties(A::class, listOf("x1", "x2", "x3", "x4", "x5"))) return null + if (!checkPropertiesWithAnnotation( + A::class, + listOf( + Pair("x4", listOf("org.jetbrains.true.true")), + Pair("x5", listOf("org.jetbrains.true.false")) + ) + )) return null + if (!checkPropertyAnnotation(::x6, "org.jetbrains.true.false")) return null + if (!checkFunctionAnnotation(::f1, "org.jetbrains.true.true")) return null + + return "OK" +} diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java new file mode 100644 index 00000000000..f1d016ab298 --- /dev/null +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/codegen/BlackBoxCodegenTestSpecGenerated.java @@ -0,0 +1,226 @@ +/* + * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * that can be found in the license/LICENSE.txt file. + */ + +package org.jetbrains.kotlin.codegen; + +import com.intellij.testFramework.TestDataPath; +import org.jetbrains.kotlin.test.JUnit3RunnerWithInners; +import org.jetbrains.kotlin.test.KotlinTestUtils; +import org.jetbrains.kotlin.test.TargetBackend; +import org.jetbrains.kotlin.test.TestMetadata; +import org.junit.runner.RunWith; + +import java.io.File; +import java.util.regex.Pattern; + +/** This class is generated by {@link org.jetbrains.kotlin.generators.tests.TestsPackage}. DO NOT MODIFY MANUALLY */ +@SuppressWarnings("all") +@TestMetadata("compiler/tests-spec/testData/codegen/box") +@TestDataPath("$PROJECT_ROOT") +@RunWith(JUnit3RunnerWithInners.class) +public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInBox() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true, "helpers", "templates"); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Linked extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInLinked() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/constant-literals") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Constant_literals extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInConstant_literals() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/constant-literals"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Boolean_literals extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInBoolean_literals() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.1.kt"); + } + + @TestMetadata("2.10.kt") + public void test2_10() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.10.kt"); + } + + @TestMetadata("2.11.kt") + public void test2_11() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.11.kt"); + } + + @TestMetadata("2.12.kt") + public void test2_12() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.12.kt"); + } + + @TestMetadata("2.13.kt") + public void test2_13() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.13.kt"); + } + + @TestMetadata("2.14.kt") + public void test2_14() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.14.kt"); + } + + @TestMetadata("2.15.kt") + public void test2_15() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.15.kt"); + } + + @TestMetadata("2.16.kt") + public void test2_16() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.16.kt"); + } + + @TestMetadata("2.17.kt") + public void test2_17() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.17.kt"); + } + + @TestMetadata("2.18.kt") + public void test2_18() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.18.kt"); + } + + @TestMetadata("2.19.kt") + public void test2_19() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.19.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.2.kt"); + } + + @TestMetadata("2.20.kt") + public void test2_20() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.20.kt"); + } + + @TestMetadata("2.21.kt") + public void test2_21() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.21.kt"); + } + + @TestMetadata("2.22.kt") + public void test2_22() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.22.kt"); + } + + @TestMetadata("2.23.kt") + public void test2_23() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.23.kt"); + } + + @TestMetadata("2.24.kt") + public void test2_24() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.24.kt"); + } + + @TestMetadata("2.25.kt") + public void test2_25() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.25.kt"); + } + + @TestMetadata("2.26.kt") + public void test2_26() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.26.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.3.kt"); + } + + @TestMetadata("2.4.kt") + public void test2_4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.4.kt"); + } + + @TestMetadata("2.5.kt") + public void test2_5() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.5.kt"); + } + + @TestMetadata("2.6.kt") + public void test2_6() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.6.kt"); + } + + @TestMetadata("2.7.kt") + public void test2_7() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.7.kt"); + } + + @TestMetadata("2.8.kt") + public void test2_8() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.8.kt"); + } + + @TestMetadata("2.9.kt") + public void test2_9() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos/2.9.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/constant-literals/boolean-literals/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + } + } + } + } + } +} diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/tasks/GenerateSpecTests.kt b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/tasks/GenerateSpecTests.kt index 7cda251ef61..e8f2e7a3565 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/tasks/GenerateSpecTests.kt +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/tasks/GenerateSpecTests.kt @@ -7,6 +7,7 @@ package org.jetbrains.kotlin.spec.tasks import org.jetbrains.kotlin.generators.tests.generator.testGroup import org.jetbrains.kotlin.checkers.AbstractDiagnosticsTestSpec +import org.jetbrains.kotlin.codegen.AbstractBlackBoxCodegenTestSpec import org.jetbrains.kotlin.parsing.AbstractParsingTestSpec import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TEST_PATH import org.jetbrains.kotlin.spec.utils.GeneralConfiguration.TESTDATA_PATH @@ -19,6 +20,9 @@ fun generateTests() { testClass { model("psi", testMethod = "doParsingTest", excludeDirs = listOf("helpers", "templates")) } + testClass { + model("codegen/box", excludeDirs = listOf("helpers", "templates")) + } } }