From e0743f22688da397e337140fc1cad285049a79b4 Mon Sep 17 00:00:00 2001 From: "anastasiia.spaseeva" Date: Thu, 26 Dec 2019 15:11:29 +0300 Subject: [PATCH] [Spec tests] Add fixed tests for expressions section, fix linkage for reference-equality-expressions section --- .../p-1/neg/2.1.exceptions.compiletime.txt | 1 - .../comparison-expressions/p-1/neg/2.1.kt | 26 --- .../comparison-expressions/testsMap.json | 10 - .../conditional-expression/p-1/pos/2.5.kt | 20 ++ .../conditional-expression/p-1/pos/2.6.kt | 19 ++ .../conditional-expression/p-1/pos/2.7.kt | 25 +++ .../conditional-expression/p-1/pos/2.8.kt | 31 +++ .../conditional-expression/p-2/pos/1.1.kt | 24 +- .../conditional-expression/p-6/pos/1.1.kt | 36 +++ .../conditional-expression/p-6/pos/1.2.kt | 28 +++ .../conditional-expression/testsMap.json | 44 +++- .../elvis-operator-expression/p-1/pos/2.1.kt | 17 +- .../p-1/pos/2.1.kt | 1 - .../p-1/pos/2.2.kt | 3 +- .../p-1/pos/2.3.kt | 1 - .../p-1/pos/2.4.kt | 1 - .../p-1/pos/2.5.kt | 1 - .../p-1/pos/3.1.kt | 1 - .../p-3/pos/2.1.kt | 34 ++- .../p-3/pos/2.2.kt | 47 ++++ .../testsMap.json | 15 ++ .../value-equality-expressions/p-2/pos/1.1.kt | 7 +- .../value-equality-expressions/p-2/pos/1.2.kt | 44 ++++ .../value-equality-expressions/p-2/pos/1.3.kt | 44 ++++ .../value-equality-expressions/p-2/pos/1.4.kt | 43 ++++ .../value-equality-expressions/p-2/pos/1.5.kt | 44 ++++ .../p-2/{neg/1.1.kt => pos/2.1.kt} | 13 +- .../value-equality-expressions/p-2/pos/2.2.kt | 45 ++++ .../value-equality-expressions/p-2/pos/2.3.kt | 44 ++++ .../value-equality-expressions/p-2/pos/2.4.kt | 44 ++++ .../value-equality-expressions/p-2/pos/2.5.kt | 45 ++++ .../value-equality-expressions/testsMap.json | 84 ++++++- .../neg/1.exceptions.compiletime.txt | 1 + .../box/notLinked/flexibility/neg/1.kt | 34 +++ .../neg/2.exceptions.compiletime.txt | 1 + .../box/notLinked/flexibility/neg/2.kt | 36 +++ .../box/notLinked/flexibility/pos/1.kt | 34 +++ .../box/notLinked/flexibility/pos/2.kt | 42 ++++ .../comparison-expressions/p-1/neg/2.1.kt | 26 +++ .../comparison-expressions/testsMap.json | 12 + .../DiagnosticsTestSpecGenerated.java | 31 +++ .../BlackBoxCodegenTestSpecGenerated.java | 209 ++++++++++++++---- 42 files changed, 1162 insertions(+), 106 deletions(-) delete mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.exceptions.compiletime.txt delete mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.5.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.6.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.7.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.8.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt rename compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/{neg/1.1.kt => pos/2.1.kt} (72%) create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.3.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.4.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.5.kt create mode 100644 compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.exceptions.compiletime.txt create mode 100644 compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.exceptions.compiletime.txt create mode 100644 compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/2.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.exceptions.compiletime.txt deleted file mode 100644 index 8f0873a76c0..00000000000 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.exceptions.compiletime.txt +++ /dev/null @@ -1 +0,0 @@ -java.lang.IllegalStateException: OPERATOR_MODIFIER_REQUIRED: 'operator' modifier is required on 'compareTo' in 'A' (24,17) in /2.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.kt deleted file mode 100644 index 3ef943a0bb3..00000000000 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg/2.1.kt +++ /dev/null @@ -1,26 +0,0 @@ -// WITH_RUNTIME - -/* - * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) - * - * SPEC VERSION: 0.1-218 - * PLACE: expressions, comparison-expressions -> paragraph 1 -> sentence 2 - * NUMBER: 1 - * DESCRIPTION: expressions, comparison-expressions -> paragraph 1 -> sentence 2 - * EXCEPTION: compiletime - */ -class A(val a: Int) { - var isCompared = false - fun compareTo(other: A): Int = run { - isCompared = true - this.a - other.a - } -} - -fun box() { - val a3 = A(-1) - val a4 = A(-3) - - val x = (a3 > a4) -} - diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/testsMap.json index 3dc60065261..e49fb5a6d0d 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/testsMap.json +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/testsMap.json @@ -1,15 +1,5 @@ { "1": { - "neg": { - "2": [ - { - "specVersion": "0.1-218", - "casesNumber": 0, - "description": "expressions, comparison-expressions -\u003e paragraph 1 -\u003e sentence 2", - "unexpectedBehaviour": false - } - ] - }, "pos": { "2": [ { diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.5.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.5.kt new file mode 100644 index 00000000000..fe479dca99e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.5.kt @@ -0,0 +1,20 @@ + +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2 + * NUMBER: 5 + * DESCRIPTION: if-expression: check the correct branch is evaluating + */ + + +fun box() : String{ + if (get(null)?: if (get(false)!!) false else get(true)!!) + return "OK" + return "NOK" +} + +fun get(b: Boolean?): Boolean? = b diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.6.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.6.kt new file mode 100644 index 00000000000..fd9232a3d6d --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.6.kt @@ -0,0 +1,19 @@ + +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2 + * NUMBER: 6 + * DESCRIPTION: if-expression: check the correct branch is evaluating + */ + +fun box() : String{ + if (get(null)?: if (get(true)!!) false else get(true)!!) + return "NOK" + return "OK" +} + +fun get(b: Boolean?): Boolean? = b diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.7.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.7.kt new file mode 100644 index 00000000000..e48d18ef361 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.7.kt @@ -0,0 +1,25 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2 + * NUMBER: 7 + * DESCRIPTION: if-expression: check the correct branch is evaluating + */ + + +fun box(): String { + val x = if (get(null) ?: if (try { + TODO() + } catch (e: NotImplementedError) { + get(false)!! + } + ) false else get(true)!! + ) get(true) else false + if (x!!) return "OK" + return "NOK" +} + +fun get(b: Boolean?): Boolean? = b diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.8.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.8.kt new file mode 100644 index 00000000000..30eb2430710 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.8.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, conditional-expression -> paragraph 1 -> sentence 2 + * NUMBER: 8 + * DESCRIPTION: if-expression: check the correct branch is evaluating + */ + +fun box(): String { + var x = 10 + var flag1 = false + if (x == 10.also { x = 11 }) { + flag1 = true + } + + var flag2 = false + if (x == if (true) {x = 12; 11} else 11) { + flag2 = true + } + var flag3 = false + if (12.also { x = 13 } == x) { + flag3 = true + } + + if (flag1 && flag2 && !flag3) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-2/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-2/pos/1.1.kt index 788d9580610..a52f5891363 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-2/pos/1.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-2/pos/1.1.kt @@ -6,10 +6,32 @@ * SPEC VERSION: 0.1-218 * PLACE: expressions, conditional-expression -> paragraph 2 -> sentence 1 * NUMBER: 1 - * DESCRIPTION: + * DESCRIPTION: branchless conditional expression, despite being of almost no practical use, is valid in Kotlin */ fun box(): String { if (true) else; + if (true) else; ; + if (true) else ; + if (true) + else; + + if (true) else + ; + val x = { + if (true) else; + } + + if (false) else; + if (false) else; ; + if (false) else ; + if (false) + else; + + if (false) else + ; + val x1 = { + if (false) else; + } return "OK" } \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.1.kt new file mode 100644 index 00000000000..60b4adda9aa --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.1.kt @@ -0,0 +1,36 @@ +// !LANGUAGE: +NewInference +// FULL_JDK +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-220 + * PLACE: expressions, conditional-expression -> paragraph 6 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The type of the condition expression must be a subtype of kotlin.Boolean, otherwise it is an error + */ + +// FILE: JavaClass.java +public class JavaClass{ + public static T id(T x) { + return null; + } + +} + +// FILE: KotlinClass.kt +import java.lang.IllegalStateException + +fun box(): String { + val x = JavaClass.id(null) // Nothing! + + return try { + val a = if (x) { + "NOK" + } else "NOK" + a + } catch (e: java.lang.IllegalStateException) { + "OK" + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.2.kt new file mode 100644 index 00000000000..c752637ba28 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.2.kt @@ -0,0 +1,28 @@ +// FULL_JDK +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-220 + * PLACE: expressions, conditional-expression -> paragraph 6 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: The type of the condition expression must be a subtype of kotlin.Boolean, otherwise it is an error + */ + +// FILE: JavaClass.java +public class JavaClass{ + public Boolean x; +} + +// FILE: KotlinClass.kt +import java.lang.IllegalStateException + +fun box(): String { + return try { + val a = if (JavaClass().x) { "NOK" } else "NOK" + a + } catch (e: java.lang.IllegalStateException) { + "OK" + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/testsMap.json index 58220a086e7..db6de1be131 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/testsMap.json +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/testsMap.json @@ -1,7 +1,49 @@ { + "6": { + "pos": { + "1": [ + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "The type of the condition expression must be a subtype of kotlin.Boolean, otherwise it is an error", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "The type of the condition expression must be a subtype of kotlin.Boolean, otherwise it is an error", + "unexpectedBehaviour": false + } + ] + } + }, "1": { "pos": { "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "if-expression: check the correct branch is evaluating", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "if-expression: check the correct branch is evaluating", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "if-expression: check the correct branch is evaluating", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "if-expression: check the correct branch is evaluating", + "unexpectedBehaviour": false + }, { "specVersion": "0.1-218", "casesNumber": 0, @@ -48,7 +90,7 @@ { "specVersion": "0.1-218", "casesNumber": 0, - "description": "", + "description": "branchless conditional expression, despite being of almost no practical use, is valid in Kotlin", "unexpectedBehaviour": false } ] diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/elvis-operator-expression/p-1/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/elvis-operator-expression/p-1/pos/2.1.kt index e5a3e4892b0..214ff719bf9 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/elvis-operator-expression/p-1/pos/2.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/elvis-operator-expression/p-1/pos/2.1.kt @@ -13,20 +13,27 @@ fun box(): String { - val x : Boolean? = null ?: getNull() ?: A().b ?: getTrue() ?: false + val x: Boolean? = null ?: getNull(null) ?: A().b ?: getTrue() ?: false + val s = null == getNull(null) ?: !getNullableTrue()!! || getFalse() ?: false + + val k = ((getNull(null)?: getNull(null) ) ?: getNull(true)) ?: getFalse() try { - val y = null ?: throw ExcA() + val y = null ?: throw ExcA() } catch (e: ExcA) { - if (x == true) return "OK" + if ((x == true && !s && k!!)) return "OK" } return "NOK" } fun getTrue() = true -fun getNull(): Boolean? = null +fun getNull(b: Boolean?): Boolean? = b class A(val b: Boolean? = null) -class ExcA() : Exception() \ No newline at end of file +class ExcA() : Exception() + +fun getFalse(): Boolean? { return false } + +fun getNullableTrue(): Boolean? { return true } \ 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 index 8682945b537..2c9864c532c 100644 --- 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 @@ -5,7 +5,6 @@ * * 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 */ 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 index cbf7e676e4d..4fcd123458b 100644 --- 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 @@ -5,8 +5,7 @@ * * 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 + * RELEVANT PLACES: 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 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 index a9826bd65e6..691b36cccd3 100644 --- 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 @@ -5,7 +5,6 @@ * * 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 */ 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 index 22f0d228ffb..751205a17e1 100644 --- 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 @@ -5,7 +5,6 @@ * * 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 */ 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 index ba5f8ad7fb2..1db2f90ce24 100644 --- 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 @@ -5,7 +5,6 @@ * * 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 */ 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 index f9a6a3f1b78..29d660e23cf 100644 --- 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 @@ -5,7 +5,6 @@ * * 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 */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.1.kt index b87143d3097..fcf46d53c9f 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.1.kt @@ -10,8 +10,13 @@ */ // FILE: JavaClass.java -public class JavaClass{ - public static Object NULL_VALUE ; +public class JavaClass { + public static Object NULL_VALUE; + + public Integer x; + + public static T id(T x) { return null; } + } // FILE: KotlinClass.kt @@ -27,10 +32,31 @@ fun box(): String { val x = null if (null === x) { if (x === null) - flag2 = true + flag2 = true } - if (flag1 && flag2) return "OK" + var flag3 = false + if (null === null) + flag3 = true + + var flag4 = false + val s: String? = null + if (s === JavaClass.NULL_VALUE) + if (JavaClass.NULL_VALUE === s) + flag4 = true + + var flag5 = false + if (null === JavaClass().x) + if (JavaClass().x === null) + flag5 = true + + var flag6 = false + if (null === JavaClass.id(null)) + if (JavaClass.id(null) === null) + flag6 = true + + + if (flag1 && flag2 && flag3 && flag4 && flag5 &&flag6) return "OK" else 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-3/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.2.kt new file mode 100644 index 00000000000..9ee4ea67293 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/pos/2.2.kt @@ -0,0 +1,47 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, reference-equality-expressions -> paragraph 3 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: Any instance of the null reference null is equal by reference to any other instance of the null reference; + */ + +// FILE: JavaClass.java +public class JavaClass { + public static Object NULL_VALUE; + + public Integer x; + + public static T id(T x) { return null; } +} + +// FILE: KotlinClass.kt +fun box(): String { + if (null !== JavaClass.NULL_VALUE) return "NOK" + if (JavaClass.NULL_VALUE !== null) return "NOK" + + val x = null + if (null !== x) return "NOK" + if (x !== null) return "NOK" + + if (null !== null) return "NOK" + + val s: String? = null + if (s !== JavaClass.NULL_VALUE) return "NOK" + if (JavaClass.NULL_VALUE !== s) return "NOK" + + if (getNull(true) !== getNull(false) === getNull(true) !== getNull(false) === getNull(true)) return "NOK" + + if (JavaClass().x !== null) return "NOK" + if (null !== JavaClass().x ) return "NOK" + + if (JavaClass.id(null) !== null) return "NOK" + if (null !== JavaClass.id(null) ) return "NOK" + + return "OK" +} + +fun getNull(x: Boolean): Any? = if (x) null else "" diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/testsMap.json index d06a9e70be6..97dd857d5af 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/testsMap.json +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/testsMap.json @@ -52,7 +52,22 @@ }, "3": { "pos": { + "3": [ + { + "specVersion": "0.1-213", + "casesNumber": 0, + "description": "check if two values are equal (\u003d\u003d\u003d) by reference", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-1/pos/2.2.kt", + "unexpectedBehaviour": false + } + ], "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "Any instance of the null reference null is equal by reference to any other instance of the null reference;", + "unexpectedBehaviour": false + }, { "specVersion": "0.1-218", "casesNumber": 0, diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.1.kt index 447211755aa..e721db35966 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.1.kt @@ -16,18 +16,21 @@ fun box(): String { val x = A(false) val y = A(false) - if (x == y) { + if ((x == y) == checkEqualls(x, y)) { if (x.isEqualsCalled && !y.isEqualsCalled) return "OK" } return "NOK" } +fun checkEqualls(A: Any?, B: Any?): Boolean { + return (A as? Any)?.equals(B) ?: (B === null) +} data class A(val a: Boolean) { var isEqualsCalled = false - override fun equals(anObject: Any?): Boolean { + override operator fun equals(anObject: Any?): Boolean { isEqualsCalled = true if (this === anObject) { return true diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt new file mode 100644 index 00000000000..eff222a4dfb --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: check value-equality-expression + */ + + +//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any; +fun box(): String { + val x = A(false) + val y = A(true) + + if ((x == y) == checkEqualls(x, y)) { + if (x.isEqualsCalled) + return "OK" + } + return "NOK" +} + +fun checkEqualls(A: Any?, B: Any?): Boolean { + return (A as? Any)?.equals(B) ?: (B === null) +} + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt new file mode 100644 index 00000000000..e4754d5085a --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: check value-equality-expression + */ + + +//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any; +fun box(): String { + val x = A(false) + val y = null + + if ((x == y) == checkEqualls(x, y)) { + if (x.isEqualsCalled) + return "OK" + } + return "NOK" +} + +fun checkEqualls(A: Any?, B: Any?): Boolean { + return (A as? Any)?.equals(B) ?: (B === null) +} + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt new file mode 100644 index 00000000000..f35089b9008 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt @@ -0,0 +1,43 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: check value-equality-expression + */ + + +//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any; +fun box(): String { + val x = null + val y = null + + if ((x == y) == checkEqualls(x, y)) { + return "OK" + } + return "NOK" +} + +fun checkEqualls(A: Any?, B: Any?): Boolean { + return (A as? Any)?.equals(B) ?: (B === null) +} + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt new file mode 100644 index 00000000000..67a7abe4756 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: expressions, equality-expressions, value-equality-expressions -> paragraph 3 -> sentence 1 + * NUMBER: 5 + * DESCRIPTION: check value-equality-expression + */ + + +//A == B is exactly the same as (A as? Any)?.equals(B) ?: (B === null) where equals is the method of kotlin.Any; +fun box(): String { + val x: A = A(false) + val y: Any = "" + + if ((x == y) == checkEqualls(x, y)) { + if (x.isEqualsCalled) + return "OK" + } + return "NOK" +} + +fun checkEqualls(A: Any?, B: Any?): Boolean { + return (A as? Any)?.equals(B) ?: (B === null) +} + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.1.kt similarity index 72% rename from compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg/1.1.kt rename to compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.1.kt index 357724b649d..5c392a37df4 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg/1.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.1.kt @@ -1,10 +1,10 @@ // WITH_RUNTIME /* - * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) * * SPEC VERSION: 0.1-218 - * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 1 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2 * NUMBER: 1 * DESCRIPTION: check value-equality-expression */ @@ -12,22 +12,27 @@ //A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any. + fun box():String{ val x = A(true) val y = A(false) - if (x != y) { + if ((x != y) == checkNotEquals(x, y)) { if (x.isEqualsCalled && !y.isEqualsCalled) return "OK" } return "NOK" } +fun checkNotEquals(A: Any?, B: Any?): Boolean { + return !((A as? Any)?.equals(B) ?: (B === null)) +} + data class A(val a: Boolean) { var isEqualsCalled = false - override fun equals(anObject: Any?): Boolean { + override operator fun equals(anObject: Any?): Boolean { isEqualsCalled = true if (this === anObject) { return true diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.2.kt new file mode 100644 index 00000000000..90420e8db75 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.2.kt @@ -0,0 +1,45 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: check value-equality-expression + */ + + +//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any. + +fun box():String{ + val x = A(true) + val y = A(true) + + if ((x != y) == checkNotEquals(x, y)) { + if (x.isEqualsCalled && !y.isEqualsCalled) + return "OK" + } + return "NOK" +} + +fun checkNotEquals(A: Any?, B: Any?): Boolean { + return !((A as? Any)?.equals(B) ?: (B === null)) +} + + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.3.kt new file mode 100644 index 00000000000..022fd08e020 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.3.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: check value-equality-expression + */ + + +//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any. + +fun box():String{ + val x = null + val y = A(true) + + if ((x != y) == checkNotEquals(x, y)) { + return "OK" + } + return "NOK" +} + +fun checkNotEquals(A: Any?, B: Any?): Boolean { + return !((A as? Any)?.equals(B) ?: (B === null)) +} + + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.4.kt new file mode 100644 index 00000000000..b30adf40b9b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.4.kt @@ -0,0 +1,44 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2 + * NUMBER: 4 + * DESCRIPTION: check value-equality-expression + */ + + +//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any. + +fun box():String{ + val x = null + val y = null + + if ((x != y) == checkNotEquals(x, y)) { + return "OK" + } + return "NOK" +} + +fun checkNotEquals(A: Any?, B: Any?): Boolean { + return !((A as? Any)?.equals(B) ?: (B === null)) +} + + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.5.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.5.kt new file mode 100644 index 00000000000..f767502578e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/2.5.kt @@ -0,0 +1,45 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, equality-expressions, value-equality-expressions -> paragraph 2 -> sentence 2 + * NUMBER: 5 + * DESCRIPTION: check value-equality-expression + */ + + +//A != B is exactly the same as !((A as? Any)?.equals(B) ?: (B === null)) where equals is the method of kotlin.Any. + +fun box():String{ + val x = A(true) + val y : Any = "" + + if ((x != y) == checkNotEquals(x, y)) { + if (x.isEqualsCalled) + return "OK" + } + return "NOK" +} + +fun checkNotEquals(A: Any?, B: Any?): Boolean { + return !((A as? Any)?.equals(B) ?: (B === null)) +} + + +data class A(val a: Boolean) { + var isEqualsCalled = false + + override operator fun equals(anObject: Any?): Boolean { + isEqualsCalled = true + if (this === anObject) { + return true + } + if (anObject is A) { + if (anObject.a == a) + return true + } + return false + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/testsMap.json index 6a927a6c929..7ac305ecd27 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/testsMap.json +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/testsMap.json @@ -1,17 +1,63 @@ { "2": { - "neg": { - "1": [ + "pos": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, { "specVersion": "0.1-218", "casesNumber": 0, "description": "check value-equality-expression", "unexpectedBehaviour": false } - ] - }, - "pos": { + ], "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "unexpectedBehaviour": false + }, { "specVersion": "0.1-218", "casesNumber": 0, @@ -24,6 +70,34 @@ "3": { "pos": { "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "check value-equality-expression", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt", + "unexpectedBehaviour": false + }, { "specVersion": "0.1-218", "casesNumber": 0, diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.exceptions.compiletime.txt new file mode 100644 index 00000000000..aa1ca783770 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: TYPE_MISMATCH: Type mismatch: inferred type is Nothing? but Boolean was expected (7,21) in /KotlinClass.kt diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.kt b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.kt new file mode 100644 index 00000000000..035e4cf314f --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.kt @@ -0,0 +1,34 @@ +// FULL_JDK +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: flexibility + * NUMBER: 1 + * DESCRIPTION: check Nothing flexibillity + * EXCEPTION: compiletime + * ISSUES: KT-35700 + */ + +// FILE: JavaClass.java +public class JavaClass{ + public static T id(T x) { + return null; + } +} + +// FILE: KotlinClass.kt + +fun box(): String { + val x = JavaClass.id(null) // Nothing! + + return try { + val a = if (x) { + "NOK" + } else "NOK" + a + } catch (e: java.lang.IllegalStateException) { + "OK" + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.exceptions.compiletime.txt new file mode 100644 index 00000000000..e3a0d14d08f --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH: Type inference failed. Expected type mismatch: inferred type is Test but Base was expected (7,38) in /KotlinClass.kt diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt new file mode 100644 index 00000000000..c0827112eee --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt @@ -0,0 +1,36 @@ +// FULL_JDK +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: flexibility + * NUMBER: 2 + * DESCRIPTION: check Nothing flexibillity + * EXCEPTION: compiletime + * ISSUES: KT-35700 + */ + +// FILE: Test.java + +public class Test extends Base { + public Test (T arg) { + super(arg); + } +} + + +// FILE: KotlinClass.kt + +open class Base(val prop: T) + +class Inheritor { + companion object { + fun default(): Base = Test(null) + } +} + +fun box() { + val v: Base = Inheritor.default() + println(v.prop.length) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/1.kt b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/1.kt new file mode 100644 index 00000000000..e120c97872a --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/1.kt @@ -0,0 +1,34 @@ +// !LANGUAGE: +NewInference +// FULL_JDK +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: flexibility + * NUMBER: 1 + * DESCRIPTION: check Nothing flexibillity + * ISSUES: KT-35700 + */ + +// FILE: JavaClass.java +public class JavaClass{ + public static T id(T x) { + return null; + } +} + +// FILE: KotlinClass.kt + +fun box(): String { + val x = JavaClass.id(null) // Nothing! + + return try { + val a = if (x) { + "NOK" + } else "NOK" + a + } catch (e: IllegalStateException) { + "OK" + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/2.kt b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/2.kt new file mode 100644 index 00000000000..269bdad2ff3 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/2.kt @@ -0,0 +1,42 @@ +// !LANGUAGE: +NewInference +// FULL_JDK +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: flexibility + * NUMBER: 2 + * DESCRIPTION: check Nothing flexibillity + * ISSUES: KT-35700 + */ + +// FILE: Test.java + +public class Test extends Base { + public Test (T arg) { + super(arg); + } +} + + +// FILE: KotlinClass.kt + +open class Base(val prop: T) + +class Inheritor { + companion object { + fun default(): Base = Test(null) + } +} + +fun box() : String{ + val v: Base = Inheritor.default() + try { + println(v.prop.length) + }catch (e: Exception ){ + return "OK" + } + return "NOK" + +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt new file mode 100644 index 00000000000..fba4c9dd6c9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt @@ -0,0 +1,26 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-220 + * PLACE: expressions, comparison-expressions -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: <, >, <= and >= operators are overloadable + */ + +// TESTCASE NUMBER: 1 +class A(val a: Int) { + fun compareTo(other: A): Int = run { + this.a - other.a + } +} + +fun case1() { + val a3 = A(-1) + val a4 = A(-3) + + val x = (a3 > a4) +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/testsMap.json index 74e3105d67b..c49cecf073f 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/testsMap.json @@ -1,4 +1,16 @@ { + "1": { + "neg": { + "2": [ + { + "specVersion": "0.1-220", + "casesNumber": 1, + "description": "\u003c, \u003e, \u003c\u003d and \u003e\u003d operators are overloadable", + "unexpectedBehaviour": false + } + ] + } + }, "4": { "neg": { "1": [ diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java index abdf7d51102..6f3506e0c78 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/checkers/DiagnosticsTestSpecGenerated.java @@ -612,6 +612,37 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions"), Pattern.compile("^(.+)\\.kt$"), true); } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + 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/diagnostics/linked/expressions/comparison-expressions/p-1"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + 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/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) 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 2ac871c9383..0869751e449 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 @@ -25,7 +25,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } public void testAllFilesPresentInBox() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "linked/declarations", "linked/statements", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg"); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "notLinked/annotations/type-annotations/pos", "linked/declarations", "linked/statements", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked") @@ -315,24 +315,6 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Neg 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/comparison-expressions/p-1/neg/2.1.kt"); - } - - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), true); - } - } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -420,6 +402,26 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/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/conditional-expression/p-1/pos/2.5.kt"); + } + + @TestMetadata("2.6.kt") + public void test2_6() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.6.kt"); + } + + @TestMetadata("2.7.kt") + public void test2_7() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.7.kt"); + } + + @TestMetadata("2.8.kt") + public void test2_8() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos/2.8.kt"); + } + public void testAllFilesPresentInPos() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), true); } @@ -456,6 +458,42 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_6 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_6() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/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/conditional-expression/p-6/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals") @@ -1249,6 +1287,11 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/reference-equality-expressions/p-3/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-3/pos/2.2.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-3/pos"), Pattern.compile("^(.+)\\.kt$"), true); } @@ -1280,24 +1323,6 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2"), Pattern.compile("^(.+)\\.kt$"), true); } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Neg 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/equality-expressions/value-equality-expressions/p-2/neg/1.1.kt"); - } - - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/neg"), Pattern.compile("^(.+)\\.kt$"), true); - } - } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -1311,6 +1336,51 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.1.kt"); } + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos/1.5.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/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/value-equality-expressions/p-2/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/value-equality-expressions/p-2/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/value-equality-expressions/p-2/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/value-equality-expressions/p-2/pos/2.5.kt"); + } + public void testAllFilesPresentInPos() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/equality-expressions/value-equality-expressions/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), true); } @@ -3123,7 +3193,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } public void testAllFilesPresentInNotLinked() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked"), Pattern.compile("^(.+)\\.kt$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked"), Pattern.compile("^(.+)\\.kt$"), true, "annotations/type-annotations/pos"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations") @@ -3135,7 +3205,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } public void testAllFilesPresentInAnnotations() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations"), Pattern.compile("^(.+)\\.kt$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations"), Pattern.compile("^(.+)\\.kt$"), true, "type-annotations/pos"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations") @@ -3147,7 +3217,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } public void testAllFilesPresentInType_annotations() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations"), Pattern.compile("^(.+)\\.kt$"), true); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations"), Pattern.compile("^(.+)\\.kt$"), true, "pos"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/annotations/type-annotations/neg") @@ -3220,6 +3290,65 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/flexibility") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Flexibility extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInFlexibility() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.kt") + public void test1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/1.kt"); + } + + @TestMetadata("2.kt") + public void test2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/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.kt") + public void test1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/1.kt"); + } + + @TestMetadata("2.kt") + public void test2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/objects") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)