diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.10.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.10.kt new file mode 100644 index 00000000000..fcb12fb4ba3 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.10.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 10 + * DESCRIPTION: ckeck a common type of String and Nothing is String + */ + + +fun box(): String { + var name: Any? = null + val men = arrayListOf(Man("Phill"), Man()) + loop@ for (i in men) { + name = i.name ?: break@loop + } + if (name is String?) return "OK" + return "NOK" +} + +private class Man(var name: String? = null) {} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.2.kt new file mode 100644 index 00000000000..078252d534b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.2.kt @@ -0,0 +1,21 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: + */ + +fun box(): String { + try { + exit() + } catch (e: NullPointerException) { + return "OK" + } + return "NOK" +} + +fun exit(): Nothing = null!! diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.3.kt new file mode 100644 index 00000000000..c2aed375993 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.3.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: + */ + +fun box(): String { + val bar = ::exit + try { + bar() + } catch (e: NotImplementedError) { + return "OK" + } + return "NOK" +} + + +private fun exit(): Nothing = TODO() diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.4.kt new file mode 100644 index 00000000000..75a551ecbe2 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.4.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: + */ + + +fun box(): String { + val bar = ::exit + try { + bar(enter()) + } catch (e: NotImplementedError) { + return "OK" + } + return "NOK" +} + + +private fun exit(x: () -> Any?): Nothing = throw Exception(x().toString()) +private fun enter(): Nothing = TODO() diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.5.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.5.kt new file mode 100644 index 00000000000..faaef87f8ad --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.5.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: + */ + + +fun box(): String { + val person = Person("Elvis") + person.name + try { + person.name = null + person.name ?: throwException("Name is required") + } catch (e: IllegalArgumentException) { + return "OK" + } + return "NOK" +} + +class Person(var name: String?) {} + +fun throwException(m: String): Nothing { + throw IllegalArgumentException(m) +} + diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.6.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.6.kt new file mode 100644 index 00000000000..65e4ff3f8d9 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.6.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 6 + * DESCRIPTION: + */ + + +fun box(): String { + val info = Info() + info.getData { "text " } + val infoUseless = InfoUseless() + try { + infoUseless.getData { throw IllegalArgumentException() } + } catch (e: IllegalArgumentException) { + return "OK" + } + return "NOK" +} + +interface Infoable { + fun getData(d: () -> T): T +} + +open class Info : Infoable { + override fun getData(d: () -> T): T { + return d() + } +} + +class InfoUseless : Info() {} + diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.7.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.7.kt new file mode 100644 index 00000000000..32f58082169 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.7.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME +// FULL_JDK + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 7 + * DESCRIPTION: + */ + +import java.util.* + +fun box() : String{ + val deque1 = ArrayDeque() + val deque2 = ArrayDeque() + deque1.add { throw IllegalArgumentException() } + deque1.add { throw NullPointerException() } + deque1.add { TODO() } + move(deque1, deque2) + val v = deque2.first as () -> Nothing + try { + v.invoke() + } catch (e: NotImplementedError) { + return "OK" + } + return "NOK" +} + +fun move(from: ArrayDeque, to: ArrayDeque) { + to.add(from.last()) +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.8.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.8.kt new file mode 100644 index 00000000000..2867c0cbcec --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.8.kt @@ -0,0 +1,37 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 8 + * DESCRIPTION: + */ + +fun box(): String { + val c = Class() + try { + val a: () -> Nothing = c.data + a.invoke() + } catch (e: IllegalArgumentException) { + try { + val d: () -> Nothing = c.value + d() + } catch (e: NotImplementedError) { + return "OK" + } + + } + return "NOK" +} + +open class Class() { + var data: () -> Nothing = { throwException("data") as Nothing } + val value: () -> Nothing + get() = { TODO() as Nothing } +} + +private fun throwException(m: String): Any { + throw IllegalArgumentException(m) +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.9.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.9.kt new file mode 100644 index 00000000000..acd3df1c328 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.9.kt @@ -0,0 +1,52 @@ +// WITH_RUNTIME +// FULL_JDK + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 9 + * DESCRIPTION: + */ + +fun box(): String { + try { + val city = City() + } catch (e: NotImplementedError) { + val city = City("", 1) + + city.country + try { + city.lakeConsumer() + } catch (e: NotImplementedError) { + try { + city.streetsConsumer.stream().forEach { street -> street.invoke() } + } catch (e: IllegalArgumentException) { + try { + val city = City("", 2) { "lake" } + city.streetsConsumer[3].invoke() + } catch (e: UnsupportedOperationException) { + return "OK" + } + } + } + } + return "NOK" +} + +class City(val name: String = "", val index: Any = TODO()) { + var country: String = "Rus" + var lakeConsumer: () -> String + var streetsConsumer: MutableList<() -> String> + + init { + lakeConsumer = { TODO() } + streetsConsumer = mutableListOf({ "x" }, { "y" }, { throw IllegalArgumentException() }) + } + + constructor(name: String, index: Any, lakeConsumer: () -> String) : this(name, index) { + this.lakeConsumer = lakeConsumer + this.streetsConsumer.add { throw UnsupportedOperationException() } + } +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/testsMap.json index c4171cae2f3..497e261a5ed 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/testsMap.json +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/testsMap.json @@ -5,7 +5,61 @@ { "specVersion": "0.1-213", "casesNumber": 0, - "description": "todo", + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "ckeck a common type of String and Nothing is String", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "check kotlin.Nothing by throwing the exception", "unexpectedBehaviour": false } ] diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/p-1/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/p-1/pos/1.1.kt new file mode 100644 index 00000000000..5c7016e5115 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/p-1/pos/1.1.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, cast-expression -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: check of the cast operators as or as? + */ + +fun box(): String { + val c = Class() + if (c.data !is () -> Nothing) return "NOK" + val e1 : () -> Nothing = c.exception as () -> Nothing as? () -> Nothing ?: return "NOK" + val v = c.value as () -> Nothing as? () -> Nothing ?: return "NOK" + + return "OK" +} + +open class Class() { + var data: () -> Nothing = { throwException("boo") as Nothing } + var exception: () -> CharSequence = { throwException("foo") as String } + val value: () -> Any + get() = { TODO() as Nothing } +} + +private fun throwException(m: String): Any { + throw IllegalArgumentException(m) +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/testsMap.json new file mode 100644 index 00000000000..2d10f339a39 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/testsMap.json @@ -0,0 +1,14 @@ +{ + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": " check of the cast operators as or as?", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.1.kt new file mode 100644 index 00000000000..8682945b537 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.1.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: check if two values are equal (===) by reference + */ + +fun box(): String { + val u1 = foo1() + val u2 = foo2() + if (u1 === u2) { + return ("OK") + } + return ("NOK") +} + +fun foo1() { + return Unit +} + +fun foo2(): Unit { + return Unit +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.2.kt new file mode 100644 index 00000000000..cbf7e676e4d --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.2.kt @@ -0,0 +1,22 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1, + * expressions, equality-expressions, reference-equality-expressions -> paragraph 3 -> sentence 3 + * expressions, equality-expressions, reference-equality-expressions -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: check if two values are equal (===) by reference + */ + +fun box(): String { + val u1 = "foo" + val u2 = "foo" + if (u1 === u2) { + return ("OK") + } + return ("NOK") +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.3.kt new file mode 100644 index 00000000000..a9826bd65e6 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.3.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: check if two values are non-equal (!==) by reference + */ + +fun box(): String { + val u1 = "boo" + val u2 = "foo" + if (u1 !== u2) { + return ("OK") + } + return ("NOK") +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.4.kt new file mode 100644 index 00000000000..22f0d228ffb --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.4.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: check if values are non-equal (!==) by reference + */ + +fun box(): String { + val u1 = "foo" + val byteArray = "foo".toByteArray(Charsets.UTF_8) + val u2 = byteArray.toString() + val u3 = byteArray.toString() + if (u1 !== u2 && u1 !== u3 && u2 !== u3 && + u2 !== u1 && u3 !== u1 && u3 !== u2 + ) { + return ("OK") + } + return ("NOK") +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.5.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.5.kt new file mode 100644 index 00000000000..ba5f8ad7fb2 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.5.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: two values are equal (===) or non-equal (!==) by reference + */ + +fun box(): String { + val c1 = c + val c2 = c + val v1 = v + val v2 = v + if (c2 === c1 && c1 === c2 && c1 === c && c2 === c && + v2 === v1 && v1 === v2 && v1 === v && v2 === v && + v2 === c1 && v1 === c2 && v1 === c && v2 === c && + c2 === v1 && c1 === v2 && c1 === v && c2 === v + ) { + return ("OK") + } + return ("NOK") +} + +const val c = 1000 +const val v = 1000 \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/3.1.kt new file mode 100644 index 00000000000..f9a6a3f1b78 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/3.1.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 1 -> sentence 3 + * RELEVANT PLACES: expressions, built-in-types-and-their-semantics, kotlin.unit -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: check equallity by refference via constructor + */ + +fun box(): String { + val u2 = mutableListOf(1, 2, 3) + val u3 = u1 + if (u1 !== u2 && u1 === u3 + ) { + return ("OK") + } + return ("NOK") +} + +val u1 = mutableListOf(1, 2, 3) + diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.1.kt new file mode 100644 index 00000000000..3cfe7e9884b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.1.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, type-checking-and-containment-checking-expressions, type-checking-expression -> paragraph 1 -> sentence 3 + * NUMBER: 1 + * DESCRIPTION:checks whether the runtime type of E is not a subtype of T for !is operator. + */ + +fun box(): String { + val bar = ::boo + val bar1 = ::exit + if (bar !is () -> Nothing && bar1 !is (Nothing) -> Nothing) return "NOK" + + return "OK" +} + +private fun boo(): Nothing = TODO() +private fun exit(x: () -> Any?): Nothing = throw Exception(x().toString()) +private fun enter(): Nothing = TODO() + diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.2.kt new file mode 100644 index 00000000000..cf9def831fe --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.2.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, type-checking-and-containment-checking-expressions, type-checking-expression -> paragraph 1 -> sentence 3 + * NUMBER: 2 + * DESCRIPTION:checks whether the runtime type of EE is a subtype of TT for is operator + */ + +fun box(): String { + val bar = ::boo + val bar1 = ::exit + + if (bar is () -> Nothing && bar1 is (Nothing) -> Nothing) return "OK" + + return "NOK" +} + +private fun boo(): Nothing = TODO() +private fun exit(x: () -> Any?): Nothing = throw Exception(x().toString()) +private fun enter(): Nothing = TODO() \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/testsMap.json new file mode 100644 index 00000000000..90852765fa5 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/testsMap.json @@ -0,0 +1,20 @@ +{ + "1": { + "pos": { + "3": [ + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "checks whether the runtime type of E is not a subtype of T for !is operator.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "checks whether the runtime type of EE is a subtype of TT for is operator", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt index 1970cf423dd..9136f68b385 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt @@ -9,11 +9,10 @@ * DESCRIPTION: todo */ -fun box() { - val b : Any? = null +fun box(): String { + val b : Nothing?= null try { - val a: Int - a = b!! + val a: Int = b!! } catch (e: NullPointerException) { return "OK" } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt new file mode 100644 index 00000000000..5eaa135d26a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt @@ -0,0 +1,69 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, built-in-types-and-their-semantics, kotlin.nothing-1 -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: check the type of jump expressions is Nothing and code placed on the left side of expression will never be executed + */ + + +// TESTCASE NUMBER: 1 + +fun case1() { + var name: Any? = null + val men = arrayListOf(Person("Phill"), Person(), Person("Bob")) + for (k in men) { + k.name + loop@ for (i in men) { + i.name + val valeua : Int = break@loop + i.name + } + k.name + val s = k.name ?: break + k.name + } + val a = 1 +} + +class Person(var name: String? = null) {} + +// TESTCASE NUMBER: 2 + +fun case2() { + var name: Any? = null + val men = arrayListOf(Person("Phill"), Person(), Person("Bob")) + for (k in men) { + loop@ for (i in men) { + i.name + val val1 = continue@loop + val1 + i.name + } + val s = k.name ?: continue + k.name + } + val a = 1 +} + +// TESTCASE NUMBER: 3 + +fun case3() { + listOf(1, 2, 3, 4, 5).forEach { x -> + val k = x + + listOf(1, 2, 3, 4, 5).forEach lit@{ + it + return@lit + print(it) + } + val y = x + if (x == 3) return + } + val a = 1 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/testsMap.json new file mode 100644 index 00000000000..f9fe04fc277 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/testsMap.json @@ -0,0 +1,14 @@ +{ + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-213", + "casesNumber": 3, + "description": "check the type of jump expressions is Nothing and code placed on the left side of expression will never be executed", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/p-2/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/p-2/pos/1.1.kt new file mode 100644 index 00000000000..86805dee393 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/p-2/pos/1.1.kt @@ -0,0 +1,57 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -UNREACHABLE_CODE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-213 + * PLACE: expressions, jump-expressions -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: check he type of jump expressions is the kotlin.Nothing + */ + +// TESTCASE NUMBER: 1 + +fun case1() { + var name: Any? = null + val men = arrayListOf(Person("Phill"), Person(), Person("Bob")) + for (k in men) { + k.name + loop@ for (i in men) { + val val1: Int = break@loop + val1 + } + val s = k.name ?: break + s + } +} + +class Person(var name: String? = null) {} + +// TESTCASE NUMBER: 2 + +fun case2() { + var name: Any? = null + val men = arrayListOf(Person("Phill"), Person(), Person("Bob")) + for (k in men) { + loop@ for (i in men) { + val val1 = continue@loop + val1 + } + val s = k.name ?: continue + s + } +} + +// TESTCASE NUMBER: 3 + +fun case3() { + listOf(1, 2, 3, 4, 5).forEach { x -> + listOf(1, 2, 3, 4, 5).forEach lit@{ + val s = return@lit + s + } + if (x == 3) return + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/testsMap.json new file mode 100644 index 00000000000..03397bebf89 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/testsMap.json @@ -0,0 +1,14 @@ +{ + "2": { + "pos": { + "1": [ + { + "specVersion": "0.1-213", + "casesNumber": 3, + "description": "check he type of jump expressions is the kotlin.Nothing", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.kt index 5bbd7b49182..6c6c8ac74a1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/neg/2.1.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -UNREACHABLE_CODE // SKIP_TXT /* @@ -16,5 +17,16 @@ class Case1(val nothing: Nothing) fun case1() { - val res = Case1(Nothing()) + val res = Case1(Nothing()) +} + + +// TESTCASE NUMBER: 2 +class Case2 { + var data: String? = null +} + +fun case2(c: Case2) { + val testValue = c.data ?: throw IllegalArgumentException("data required") + testValue checkType { check() } } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt index 2ac7c96852b..bd564eec87d 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt @@ -1,4 +1,6 @@ // !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -UNREACHABLE_CODE + // SKIP_TXT /* @@ -8,26 +10,30 @@ * PLACE: type-system, type-kinds, built-in-types, kotlin.nothing -> paragraph 1 -> sentence 1 * NUMBER: 1 * DESCRIPTION: Check of Nothing type is a subtype of any types - * HELPERS: checkType + * HELPERS: checkType, functions */ class NothingWrapper() { - val data: Nothing + val data: Nothing = TODO() } -class CustomClass +class CustomClass() {} // TESTCASE NUMBER: 1 -fun case1(wrapper: NothingWrapper) { +fun case1() { + val wrapper: NothingWrapper = NothingWrapper() + checkSubtype(wrapper.data) + checkSubtype(wrapper.data) + checkSubtype(wrapper.data) checkSubtype>(wrapper.data) checkSubtype(wrapper.data) checkSubtype(wrapper.data) checkSubtype(wrapper.data) checkSubtype(wrapper.data) - checkSubtype(wrapper.data) + checkSubtype>(wrapper.data) checkSubtype(wrapper.data) } @@ -35,10 +41,10 @@ fun case1(wrapper: NothingWrapper) { fun case2(wrapper: NothingWrapper) { checkSubtype>(wrapper.data) checkSubtype>(wrapper.data) + checkSubtype>(wrapper.data) + checkSubtype>(wrapper.data) checkSubtype>(wrapper.data) checkSubtype(wrapper.data) - checkSubtype(wrapper.data) - checkSubtype(wrapper.data) } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/2.1.kt index ed54d0b27bc..4b7028791b1 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/2.1.kt @@ -1,4 +1,5 @@ // !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION -UNREACHABLE_CODE // SKIP_TXT /* @@ -8,11 +9,11 @@ * PLACE: type-system, type-kinds, built-in-types, kotlin.nothing -> paragraph 1 -> sentence 2 * NUMBER: 1 * DESCRIPTION: Check of Nothing as a subtype of any type - * HELPERS: checkType + * HELPERS: checkType, functions */ // TESTCASE NUMBER: 1 -class Case1() { +class Case1 { val data: Nothing = TODO() } @@ -21,26 +22,16 @@ fun case1(c: Case1) { checkSubtype>(c.data) } + // TESTCASE NUMBER: 2 class Case2 { - var data: String -} - -fun case2(c: Case2) { - val testValue = c.data ?: throw IllegalArgumentException("data required") - testValue checkType { check() } -} - -// TESTCASE NUMBER: 3 -class Case3 { - val dataFunction = fail("fail msg") + val dataFunction: Nothing = fail("fail msg") } fun fail(msg: String): Nothing { - throw new Exception (msg) + throw Exception(msg) } -fun case3(c: Case3) { - val testValue = c.dataFunction() - checkType(testValue) +fun case2(c: Case2) { + c.dataFunction checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/testsMap.json index ee9252a91f1..14c94a0f7eb 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types/kotlin.nothing/testsMap.json @@ -4,7 +4,7 @@ "2": [ { "specVersion": "0.1-213", - "casesNumber": 1, + "casesNumber": 2, "description": "Check of Nothing type", "unexpectedBehaviour": false } @@ -14,7 +14,7 @@ "2": [ { "specVersion": "0.1-213", - "casesNumber": 3, + "casesNumber": 2, "description": "Check of Nothing as a subtype of any type", "unexpectedBehaviour": false } diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java index e247bb9ce27..c7a42be5903 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java @@ -153,6 +153,196 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Built_in_types_and_their_semantics extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBuilt_in_types_and_their_semantics() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Kotlin_nothing_1 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInKotlin_nothing_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/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, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.1.kt"); + } + + @TestMetadata("1.10.kt") + public void test1_10() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.10.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.5.kt"); + } + + @TestMetadata("1.6.kt") + public void test1_6() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.6.kt"); + } + + @TestMetadata("1.7.kt") + public void test1_7() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.7.kt"); + } + + @TestMetadata("1.8.kt") + public void test1_8() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.8.kt"); + } + + @TestMetadata("1.9.kt") + public void test1_9() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos/1.9.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.unit") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Kotlin_unit extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInKotlin_unit() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.unit"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.unit/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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.unit/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, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Cast_expression extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInCast_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/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, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/p-1/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/cast-expression/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -745,6 +935,150 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Equality_expressions extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInEquality_expressions() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Reference_equality_expressions extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInReference_equality_expressions() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/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, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.2.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.3.kt"); + } + + @TestMetadata("2.4.kt") + public void test2_4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.4.kt"); + } + + @TestMetadata("2.5.kt") + public void test2_5() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.5.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/3.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Type_checking_and_containment_checking_expressions extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInType_checking_and_containment_checking_expressions() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Type_checking_expression extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInType_checking_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/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, this, testDataFilePath); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.1.kt"); + } + + @TestMetadata("3.2.kt") + public void test3_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos/3.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/type-checking-and-containment-checking-expressions/type-checking-expression/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + } } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system") @@ -877,6 +1211,81 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Type_kinds extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInType_kinds() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Built_in_types extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBuilt_in_types() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Kotlin_nothing extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInKotlin_nothing() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/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, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/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, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos/1.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/type-system/type-kinds/built-in-types/kotlin.nothing/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } + } + } } }