Add generated codegen box tests for Boolean literals as identifiers

This commit is contained in:
victor.petukhov
2018-09-25 13:07:36 +03:00
parent 1bc0c4092c
commit 4819223b74
28 changed files with 1297 additions and 0 deletions
@@ -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"
}
@@ -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"
}
@@ -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> T.`true`() = listOf(0).`false`()
inline fun <reified T, K> K?.`false`(x1: T = 10 as T)
where K : List<T>,
K : Iterable<T>,
T : Comparable<T>,
T : Number = false
fun box(): String? {
if (!`true`()) return null
if (null.`false`<Int, List<Int>>()) 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<Int>::`false`, "false")) return null
if (!checkFunctionName(Nothing?::`true`, "true")) return null
return "OK"
}
@@ -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"
}
@@ -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`<T>
typealias D<`false`> = `true`<`false`>
inline fun <reified `true`, reified `false`> f1() =
when (`false`()) {
is `true` -> true
is `false` -> false
else -> false
}
inline fun <reified T : D<`false`>> T.f2(value: T) = value is `false`
class A<K: List<out `true`<out String>>> {
val x = true
}
class B<K, T: A<List<out `true`<String>>>> {
var x = false
}
fun <T : org.jetbrains.`true`.`false`> T.f3() = false
fun f4(x1: List<out `true`<String>>): Boolean {
return true
}
fun f5(x1: List<List<List<`false`?>>>) = false
fun f6(x1: `false`) = false
fun f7(x1: `true`<*>) = true
fun f8(x1: `true`<out Any>) = false
fun f9(x1: `true`<out List<`true`<*>>>) = true
val x1: List<`false`?> = listOf(`false`(), null, `false`())
lateinit var x2: List<`true`<out Number>?>
fun box(): String? {
x2 = listOf(`true`<Int>(), null, `true`())
if (!f1<`false`, `true`<`false`>>()) return null
if (`true`<`false`>().f2(`true`())) return null
if (!A<List<`true`<String>>>().x) return null
if (B<`false`, A<List<`true`<String>>>>().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`<Nothing>())) return null
if (f8(`true`<`false`>())) return null
if (!f9(`true`<List<`true`<`false`>>>())) return null
if (x1.containsAll(listOf(`false`(), null, `false`()))) return null
if (x2.containsAll(listOf(`true`<Int>(), null, `true`()))) return null
if (!checkCallableTypeParametersWithUpperBounds(
`true`<`false`>::f2,
listOf(
Pair("T", listOf("org.jetbrains.`true`.D<org.jetbrains.`true`.`false`> /* = org.jetbrains.`true`.`true`<org.jetbrains.`true`.`false`> */"))
)
)) return null
if (!checkClassTypeParametersWithUpperBounds(
A::class,
listOf(
Pair("K", listOf("kotlin.collections.List<out org.jetbrains.`true`.`true`<out kotlin.String>>"))
)
)) return null
if (!checkClassTypeParametersWithUpperBounds(
B::class,
listOf(
Pair("T", listOf("org.jetbrains.`true`.A<kotlin.collections.List<out org.jetbrains.`true`.`true`<kotlin.String>>>"))
)
)) return null
if (!checkCallableTypeParametersWithUpperBounds(
`false`::f3,
listOf(
Pair("T", listOf("org.jetbrains.`true`.`false`"))
)
)) return null
if (!checkParameterType(::f4, "x1", "kotlin.collections.List<out org.jetbrains.`true`.`true`<kotlin.String>>")) return null
if (!checkParameterType(::f5, "x1", "kotlin.collections.List<kotlin.collections.List<kotlin.collections.List<org.jetbrains.`true`.`false`?>>>")) return null
if (!checkPropertyType(::x1, "kotlin.collections.List<org.jetbrains.`true`.`false`?>")) return null
if (!checkPropertyType(::x2, "kotlin.collections.List<org.jetbrains.`true`.`true`<out kotlin.Number>?>")) 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`<out kotlin.Any>")) return null
if (!checkParameterType(::f9, "x1", "org.jetbrains.`true`.`true`<out kotlin.collections.List<org.jetbrains.`true`.`true`<*>>>")) return null
return "OK"
}
@@ -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`<T> {
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 <reified `false`, reified `true` : Any> `false`.f2() = true
val <`false`> `false`.x1: `true`<Int>
get() = `true`<Int>()
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<Byte>()) return null
if (!0.f2<Int, `false`>()) 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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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`<Boolean> = 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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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<String, String>): 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"
}
@@ -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"
}
@@ -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"
}
@@ -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<List<Nothing?>> `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<MutableSet<Any>, Comparable<MutableSet<Any>>>()) return null
if (A<String, String>().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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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` <T> (val a: String)
class A {
@field:`false`
val x1: Int = 0
@setparam:`false`
var x2: Int = 1
val @receiver:org.jetbrains.`true`.`true`<List<Int>>("false") String.x3: Int
get() {
return 2
}
@org.jetbrains.`true`.`true`<Int>("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"
}