diff --git a/compiler/tests-spec/testData/codegen/box/helpers/reflect.kt b/compiler/tests-spec/testData/codegen/box/helpers/reflect.kt index 5369d9a07a7..2c36ec516d0 100644 --- a/compiler/tests-spec/testData/codegen/box/helpers/reflect.kt +++ b/compiler/tests-spec/testData/codegen/box/helpers/reflect.kt @@ -55,7 +55,7 @@ fun checkCallableTypeParametersWithUpperBounds(callableRef: KCallable<*>, typePa fun checkSuperTypeAnnotation(classRef: KClass<*>, superClassName: String, annotationName: String): Boolean { val superType = classRef.supertypes.find { it.classifier.toString() == superClassName } - return superType?.annotations?.find { it.annotationClass.qualifiedName == annotationName } != null ?: false + return superType?.annotations?.find { it.annotationClass.qualifiedName == annotationName } != null } fun checkClassName(ref: KClass<*>, expectedQualifiedName: String) = ref.qualifiedName == expectedQualifiedName @@ -64,7 +64,7 @@ fun checkPackageName(fileClass: String, expectedName: String) = Class.forName(fileClass).`package`.name == expectedName fun checkFileAnnotation(fileClass: String, expectedName: String) = - Class.forName(fileClass)?.annotations?.find { it.annotationClass.qualifiedName == expectedName } != null ?: false + Class.forName(fileClass)?.annotations?.find { it.annotationClass.qualifiedName == expectedName } != null fun checkFileAnnotations(fileClass: String, expectedNames: List) = expectedNames.all { checkFileAnnotation(fileClass, it) } 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 index 60b4adda9aa..507f79a1626 100644 --- 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 @@ -1,4 +1,3 @@ -// !LANGUAGE: +NewInference // FULL_JDK // WITH_RUNTIME @@ -13,24 +12,17 @@ // FILE: JavaClass.java public class JavaClass{ - public static T id(T x) { - return null; - } - + public Boolean x; } // 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" + val a = if (JavaClass().x) { "NOK" } else "NOK" a - } catch (e: java.lang.IllegalStateException) { + } catch (e: java.lang.NullPointerException) { "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 deleted file mode 100644 index c752637ba28..00000000000 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos/1.2.kt +++ /dev/null @@ -1,28 +0,0 @@ -// 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 db6de1be131..b64701bd4b6 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 @@ -2,12 +2,6 @@ "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, diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.1.kt index 94beb63b87a..75c027a45ec 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.1.kt @@ -6,7 +6,8 @@ * NUMBER: 1 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the class. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect + * UNEXPECTED BEHAVIOUR */ open class `true` { diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.10.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.10.kt index 3a0844d39ff..eec90c17689 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.10.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.10.kt @@ -6,7 +6,7 @@ * NUMBER: 10 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the companionObject. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.11.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.11.kt index 2e7662dfc84..6fd6cad3f98 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.11.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.11.kt @@ -6,7 +6,7 @@ * NUMBER: 11 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the function. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ fun `true`(): Boolean { diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.12.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.12.kt index 84cb3f705a7..c1e04b0a374 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.12.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.12.kt @@ -6,7 +6,7 @@ * NUMBER: 12 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the setter. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ class A { diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.13.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.13.kt index 4bdbc5627df..4b58421e8f3 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.13.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.13.kt @@ -6,7 +6,7 @@ * NUMBER: 13 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the simpleUserType. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.14.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.14.kt index 9a62b69e374..36c626907ff 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.14.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.14.kt @@ -6,7 +6,7 @@ * NUMBER: 14 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeParameter. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.15.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.15.kt index 9c1b852f4de..22df8568e0e 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.15.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.15.kt @@ -6,7 +6,7 @@ * NUMBER: 15 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the parameter. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ fun f1(`true`: Boolean) = !!!`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.16.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.16.kt index 74940af1393..f35f9f73d27 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.16.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.16.kt @@ -6,7 +6,8 @@ * NUMBER: 16 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationComplex. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect + * UNEXPECTED BEHAVIOUR */ @file:[org.jetbrains.`true`.`false`() `true`] diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.17.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.17.kt index b86c80a78e6..1048b1bbc90 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.17.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.17.kt @@ -6,7 +6,7 @@ * NUMBER: 17 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the object. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ open class A { diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.18.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.18.kt index 4c96f41b27a..ab2e156f7dd 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.18.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.18.kt @@ -6,7 +6,7 @@ * NUMBER: 18 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeAlias. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ typealias `true` = Boolean diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.26.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.26.kt index 4bc8053ecb4..1c7d4fcfa7d 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.26.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.26.kt @@ -6,7 +6,7 @@ * NUMBER: 26 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the callableReference. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ val Boolean.`true`: Boolean diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.3.kt index d709b39f868..3bf1f93306b 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.3.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.3.kt @@ -6,7 +6,7 @@ * NUMBER: 3 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the typeConstraint. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ class A <`true`, `false`> diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.4.kt index 8001c3e32bb..3a8403f9d54 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.4.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.4.kt @@ -6,7 +6,7 @@ * NUMBER: 4 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the fileAnnotationSimple. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ @file:`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.5.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.5.kt index c86cd4292e1..8033f927c95 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.5.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.5.kt @@ -6,7 +6,7 @@ * NUMBER: 5 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageComplex. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.6.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.6.kt index c13c0d5e4aa..27670c18e82 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.6.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.6.kt @@ -6,7 +6,7 @@ * NUMBER: 6 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the packageSimple. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ package `true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.9.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.9.kt index 4ae767bf4dc..9d6c07e2994 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.9.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/p-1/pos/2.9.kt @@ -6,7 +6,7 @@ * NUMBER: 9 * DESCRIPTION: The use of Boolean literals as the identifier (with backtick) in the unescapedAnnotation. * NOTE: this test data is generated by FeatureInteractionTestDataGenerator. DO NOT MODIFY CODE MANUALLY! - * HELPERS: REFLECT + * HELPERS: reflect */ package org.jetbrains.`true` diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/testsMap.json index 83bf33dd0c2..c888854e20d 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/testsMap.json +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/constant-literals/boolean-literals/testsMap.json @@ -18,7 +18,7 @@ "specVersion": "0.1-100", "casesNumber": 0, "description": "The use of Boolean literals as the identifier (with backtick) in the class.", - "unexpectedBehaviour": false + "unexpectedBehaviour": true }, { "specVersion": "0.1-100", @@ -102,7 +102,7 @@ "specVersion": "0.1-100", "casesNumber": 0, "description": "The use of Boolean literals as the identifier (with backtick) in the fileAnnotationComplex.", - "unexpectedBehaviour": false + "unexpectedBehaviour": true }, { "specVersion": "0.1-100", 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 index e3a0d14d08f..17bf520ec02 100644 --- 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 @@ -1 +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 +java.lang.IllegalStateException: TYPE_MISMATCH: 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 index c0827112eee..24475f715de 100644 --- a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt +++ b/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg/2.kt @@ -24,7 +24,7 @@ public class Test extends Base { open class Base(val prop: T) -class Inheritor { +class Inheritor { companion object { fun default(): Base = Test(null) } 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 deleted file mode 100644 index e120c97872a..00000000000 --- a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/1.kt +++ /dev/null @@ -1,34 +0,0 @@ -// !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 deleted file mode 100644 index 269bdad2ff3..00000000000 --- a/compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos/2.kt +++ /dev/null @@ -1,42 +0,0 @@ -// !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/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/testsMap.json index 0873f28e4f1..efe6f9b6165 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph/expressions-1/conditional-expressions/testsMap.json @@ -57,6 +57,58 @@ "casesNumber": 3, "description": "check if-expressions must have both branches.", "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive with nullability check before", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckBefore.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive with nullability check else", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckElse.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "neg": { + "1": [ + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "When type disjunctions", + "path": "compiler/testData/diagnostics/tests/when/WhenTypeDisjunctions.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive break continue", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBreakContinue.kt", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive return throw", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveReturnThrow.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive return", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveReturn.kt", + "unexpectedBehaviour": false } ] } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/call-and-property-access-expressions/callable-references/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/call-and-property-access-expressions/callable-references/testsMap.json new file mode 100644 index 00000000000..f340b1aeb2b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/call-and-property-access-expressions/callable-references/testsMap.json @@ -0,0 +1,35 @@ +{ + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "Class vs package", + "path": "compiler/testData/diagnostics/tests/callableReference/classVsPackage.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "Bare type", + "path": "compiler/testData/diagnostics/tests/callableReference/bareType.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "11": { + "pos": { + "3": [ + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "Callable reference as last expression in block", + "path": "compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.kt index 8195fe385e2..d71124c2ac5 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/p-6/neg/1.1.kt @@ -50,3 +50,21 @@ fun case2() { if (a) { "true" } else "false" checkSubtype(a) } + +// TESTCASE NUMBER: 3 +// FILE: JavaClassCase3.java +public class JavaClassCase3{ + public static T id(T x) { + return null; + } +} + +// FILE: KotlinClassCase3.kt +// TESTCASE NUMBER: 3 +fun case3() { + val x = JavaClassCase3.id(null) // Nothing! + x + val a = if (x) { + "NOK" + } else "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/testsMap.json index 6f49d924012..a45c9fb531b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/conditional-expression/testsMap.json @@ -4,7 +4,7 @@ "1": [ { "specVersion": "0.1-218", - "casesNumber": 2, + "casesNumber": 3, "description": "The type of the condition expression must be a subtype of kotlin.Boolean", "unexpectedBehaviour": true } @@ -20,5 +20,59 @@ } ] } + }, + "4": { + "pos": { + "1": [ + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Kt10811", + "path": "compiler/testData/diagnostics/tests/when/kt10811.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Kt9972", + "path": "compiler/testData/diagnostics/tests/when/kt9972.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Kt10809", + "path": "compiler/testData/diagnostics/tests/when/kt10809.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Kt10439", + "path": "compiler/testData/diagnostics/tests/when/kt10439.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "5": { + "pos": { + "1": [ + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Kt9972", + "path": "compiler/testData/diagnostics/tests/when/kt9972.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Kt10439", + "path": "compiler/testData/diagnostics/tests/when/kt10439.kt", + "unexpectedBehaviour": false + } + ] + } } } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt index 9a8b80b6221..b6d9de9d174 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/boolean-literals/p-1/neg/3.1.kt @@ -10,12 +10,12 @@ // TESTCASE NUMBER: 1 fun case_1() { - true checkType { check() } - false checkType { check() } + true checkType { check() } + false checkType { check() } - true checkType { check() } - false checkType { check() } + true checkType { check() } + false checkType { check() } - true checkType { check() } - false checkType { check() } + true checkType { check() } + false checkType { check() } } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.kt index eabfbaeda61..017e4a93639 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.2.kt @@ -14,25 +14,25 @@ val value_1 = E0 val value_2 = e000 // TESTCASE NUMBER: 3 -val value_3 = E+0 +val value_3 = E+0 // TESTCASE NUMBER: 4 val value_4 = e00 // TESTCASE NUMBER: 5 -val value_5 = e+1 +val value_5 = e+1 // TESTCASE NUMBER: 6 val value_6 = e22 // TESTCASE NUMBER: 7 -val value_7 = E-333 +val value_7 = E-333 // TESTCASE NUMBER: 8 val value_8 = e4444 // TESTCASE NUMBER: 9 -val value_9 = e-55555 +val value_9 = e-55555 // TESTCASE NUMBER: 10 val value_10 = e666666 @@ -41,7 +41,7 @@ val value_10 = e666666 val value_11 = E7777777 // TESTCASE NUMBER: 12 -val value_12 = e-88888888 +val value_12 = e-88888888 // TESTCASE NUMBER: 13 -val value_13 = E+999999999 +val value_13 = E+999999999 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.kt index 5518a79c609..721d97dff97 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/real-literals/p-2/neg/1.3.kt @@ -14,25 +14,25 @@ val value_1 = E0f val value_2 = e000F // TESTCASE NUMBER: 3 -val value_3 = E+0f +val value_3 = E+0f // TESTCASE NUMBER: 4 val value_4 = e00f // TESTCASE NUMBER: 5 -val value_5 = e+1F +val value_5 = e+1F // TESTCASE NUMBER: 6 val value_6 = e22F // TESTCASE NUMBER: 7 -val value_7 = E-333F +val value_7 = E-333F // TESTCASE NUMBER: 8 val value_8 = e4444f // TESTCASE NUMBER: 9 -val value_9 = e-55555f +val value_9 = e-55555f // TESTCASE NUMBER: 10 val value_10 = e666666F @@ -41,7 +41,7 @@ val value_10 = e666666F val value_11 = E7777777f // TESTCASE NUMBER: 12 -val value_12 = e-88888888F +val value_12 = e-88888888F // TESTCASE NUMBER: 13 -val value_13 = E+999999999F +val value_13 = E+999999999F diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.kt index 9359da23491..de22082a0b7 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.2.kt @@ -12,12 +12,12 @@ // TESTCASE NUMBER: 1 fun case_1() { - 0L checkType { check() } - 1000000L checkType { check() } - 0XAf10cDL checkType { check() } - 0x0_0L checkType { check() } - 0b100_000_111_111L checkType { check() } - 0b0L checkType { check() } + 0L checkType { check() } + 1000000L checkType { check() } + 0XAf10cDL checkType { check() } + 0x0_0L checkType { check() } + 0b100_000_111_111L checkType { check() } + 0b0L checkType { check() } checkSubtype(0L) checkSubtype(1000000L) diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.kt index 5e384a74fdb..be8552e8227 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.3.kt @@ -12,84 +12,84 @@ // TESTCASE NUMBER: 1 fun case_1() { - 0 checkType { check() } - 0 checkType { check() } - 0 checkType { check() } + 0 checkType { check() } + 0 checkType { check() } + 0 checkType { check() } } // TESTCASE NUMBER: 2 fun case_2() { - 127 checkType { check() } - 127 checkType { check() } - 127 checkType { check() } + 127 checkType { check() } + 127 checkType { check() } + 127 checkType { check() } checkSubtype(128) - 128 checkType { check() } - 128 checkType { check() } - 128 checkType { check() } + 128 checkType { check() } + 128 checkType { check() } + 128 checkType { check() } - -128 checkType { check() } - -128 checkType { check() } - -128 checkType { check() } + -128 checkType { check() } + -128 checkType { check() } + -128 checkType { check() } checkSubtype(-129) - -129 checkType { check() } - -129 checkType { check() } - -129 checkType { check() } + -129 checkType { check() } + -129 checkType { check() } + -129 checkType { check() } } // TESTCASE NUMBER: 3 fun case_3() { checkSubtype(32767) - 32767 checkType { check() } - 32767 checkType { check() } - 32767 checkType { check() } + 32767 checkType { check() } + 32767 checkType { check() } + 32767 checkType { check() } checkSubtype(32768) checkSubtype(32768) - 32768 checkType { check() } - 32768 checkType { check() } - 32768 checkType { check() } + 32768 checkType { check() } + 32768 checkType { check() } + 32768 checkType { check() } checkSubtype(-32768) - -32768 checkType { check() } - -32768 checkType { check() } - -32768 checkType { check() } + -32768 checkType { check() } + -32768 checkType { check() } + -32768 checkType { check() } checkSubtype(-32769) checkSubtype(-32769) - -32769 checkType { check() } - -32769 checkType { check() } - -32769 checkType { check() } + -32769 checkType { check() } + -32769 checkType { check() } + -32769 checkType { check() } } // TESTCASE NUMBER: 4 fun case_4() { checkSubtype(2147483647) checkSubtype(2147483647) - 2147483647 checkType { check() } - 2147483647 checkType { check() } - 2147483647 checkType { check() } + 2147483647 checkType { check() } + 2147483647 checkType { check() } + 2147483647 checkType { check() } checkSubtype(2147483648) checkSubtype(2147483648) checkSubtype(2147483648) - 2147483648 checkType { check() } - 2147483648 checkType { check() } - 2147483648 checkType { check() } + 2147483648 checkType { check() } + 2147483648 checkType { check() } + 2147483648 checkType { check() } checkSubtype(-2147483648) checkSubtype(-2147483648) - -2147483648 checkType { check() } - -2147483648 checkType { check() } - -2147483648 checkType { check() } + -2147483648 checkType { check() } + -2147483648 checkType { check() } + -2147483648 checkType { check() } checkSubtype(-2147483649) checkSubtype(-2147483649) checkSubtype(-2147483649) - -2147483649 checkType { check() } - -2147483649 checkType { check() } - -2147483649 checkType { check() } + -2147483649 checkType { check() } + -2147483649 checkType { check() } + -2147483649 checkType { check() } } // TESTCASE NUMBER: 5 @@ -97,16 +97,16 @@ fun case_5() { checkSubtype(9223372036854775807) checkSubtype(9223372036854775807) checkSubtype(9223372036854775807) - 9223372036854775807 checkType { check() } - 9223372036854775807 checkType { check() } - 9223372036854775807 checkType { check() } + 9223372036854775807 checkType { check() } + 9223372036854775807 checkType { check() } + 9223372036854775807 checkType { check() } checkSubtype(-9223372036854775807) checkSubtype(-9223372036854775807) checkSubtype(-9223372036854775807) - -9223372036854775807 checkType { check() } - -9223372036854775807 checkType { check() } - -9223372036854775807 checkType { check() } + -9223372036854775807 checkType { check() } + -9223372036854775807 checkType { check() } + -9223372036854775807 checkType { check() } } // TESTCASE NUMBER: 6 @@ -115,8 +115,8 @@ fun case_6() { checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) checkSubtype(-100000000000000000000000000000000) - -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } -100000000000000000000000000000000 checkType { check() } - -100000000000000000000000000000000 checkType { check() } + -100000000000000000000000000000000 checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.kt index d0ee23e9571..29c3d332f47 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.4.kt @@ -13,23 +13,23 @@ // TESTCASE NUMBER: 1 fun case_1() { checkSubtype(-9223372036854775808L) - -9223372036854775808L checkType { check() } + -9223372036854775808L checkType { check() } - checkSubtype(9223372036854775808L) - 9223372036854775808L checkType { check() } + checkSubtype(9223372036854775808L) + 9223372036854775808L checkType { check() } } // TESTCASE NUMBER: 2 fun case_2() { - checkSubtype(100000000000000000000000000000000L) - 100000000000000000000000000000000L checkType { check() } + checkSubtype(100000000000000000000000000000000L) + 100000000000000000000000000000000L checkType { check() } - checkSubtype(100000000000000000000000000000000l) - 100000000000000000000000000000000l checkType { check() } + checkSubtype(100000000000000000000000000000000l) + 100000000000000000000000000000000l checkType { check() } checkSubtype(-100000000000000000000000000000000L) - -100000000000000000000000000000000L checkType { check() } + -100000000000000000000000000000000L checkType { check() } checkSubtype(-100000000000000000000000000000000l) - -100000000000000000000000000000000l checkType { check() } + -100000000000000000000000000000000l checkType { check() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.kt index 910dcda6a4a..877d7bb9daa 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/constant-literals/the-types-for-integer-literals/p-1/neg/2.5.kt @@ -37,7 +37,7 @@ fun case_1() { f1(-2147483648) f1(9223372036854775807) f1(-9223372036854775807) - f1(1000000000000000000000000000000000000000000000000) + f1(1000000000000000000000000000000000000000000000000) f1(-1000000000000000000000000000000000000000000000000) } @@ -49,7 +49,7 @@ fun case_2() { f2(-2147483648) f2(9223372036854775807) f2(-9223372036854775807) - f2(1000000000000000000000000000000000000000000000000) + f2(1000000000000000000000000000000000000000000000000) f2(-1000000000000000000000000000000000000000000000000) } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/testsMap.json index 3be3afac23f..22662fabfd3 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/testsMap.json @@ -424,13 +424,6 @@ "path": "compiler/testData/diagnostics/tests/when/ExhaustivePlatformEnumElse.kt", "unexpectedBehaviour": false }, - { - "specVersion": "0.1-152", - "casesNumber": 0, - "description": "Kt9929", - "path": "compiler/testData/diagnostics/tests/when/kt9929.kt", - "unexpectedBehaviour": false - }, { "specVersion": "0.1-152", "casesNumber": 0, @@ -640,31 +633,6 @@ } }, "1": { - "pos": { - "1": [ - { - "specVersion": "0.1-152", - "casesNumber": 0, - "description": "Kt9929", - "path": "compiler/testData/diagnostics/tests/when/kt9929.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-152", - "casesNumber": 0, - "description": "Kt4434", - "path": "compiler/testData/diagnostics/tests/when/kt4434.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-152", - "casesNumber": 0, - "description": "Non exhaustive boolean nullable", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveBooleanNullable.kt", - "unexpectedBehaviour": false - } - ] - }, "neg": { "1": [ { @@ -759,6 +727,24 @@ "unexpectedBehaviour": false } ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Kt4434", + "path": "compiler/testData/diagnostics/tests/when/kt4434.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive boolean nullable", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveBooleanNullable.kt", + "unexpectedBehaviour": false + } + ] } }, "3": { diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.kt index cf27dd68098..e9e07e0684e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.kt @@ -116,11 +116,15 @@ fun case_8(value_1: Int, value_2: Int) = when { else "4" } -// TESTCASE NUMBER: 9 +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-37249 + */ fun case_9(value_1: Int, value_2: String, value_3: String) = when { - value_1 == 1 -> try { 4 } catch (e: Exception) { 5 } - value_1 == 2 -> try { throw Exception() } catch (e: Exception) { value_2 } - else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { } + value_1 == 1 -> try { 4 } catch (e: Exception) { 5 } + value_1 == 2 -> try { throw Exception() } catch (e: Exception) { value_2 } + else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { } } // TESTCASE NUMBER: 10 diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.kt similarity index 58% rename from compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.kt index 9d65244fab7..a845e9d78c6 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.kt @@ -1,19 +1,19 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) * * SPEC VERSION: 0.1-100 * PLACE: expressions, when-expression -> paragraph 2 -> sentence 1 - * NUMBER: 1 - * DESCRIPTION: Forbidden break and continue in the control structure body of when. + * NUMBER: 2 + * DESCRIPTION: Allowed break and continue in the control structure body of when. */ // TESTCASE NUMBER: 1 fun case_1(value_1: Int): String { while (true) { when { - value_1 == 1 -> break + value_1 == 1 -> break } } @@ -24,7 +24,7 @@ fun case_1(value_1: Int): String { fun case_2(value_1: Int): String { while (true) { when { - value_1 == 1 -> continue + value_1 == 1 -> continue } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.kt index da93bc9e5db..2739c21fd8b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.kt @@ -117,12 +117,16 @@ fun case_8(value_1: Int, value_2: Int) = when (value_1) { else "4" } -// TESTCASE NUMBER: 9 +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-37249 + */ fun case_9(value_1: Int, value_2: String, value_3: String): Any { return when (value_1) { 1 -> try { 4 } catch (e: Exception) { 5 } 2 -> try { throw Exception() } catch (e: Exception) { value_2 } - else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { } + else -> try { throw Exception() } catch (e: Exception) { {value_3} } finally { } } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.kt similarity index 59% rename from compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.kt rename to compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.kt index ab29190f9e3..c30db826b99 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.kt @@ -1,12 +1,12 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) * * SPEC VERSION: 0.1-100 * PLACE: expressions, when-expression -> paragraph 5 -> sentence 1 - * NUMBER: 1 - * DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in the control structure body. + * NUMBER: 2 + * DESCRIPTION: 'When' with bound value and allowed break and continue expression (without labels) in the control structure body. */ // TESTCASE NUMBER: 1 @@ -14,7 +14,7 @@ fun case_1(value_1: Int): Int { while (true) { when (value_1) { 1 -> return 1 - 2 -> break + 2 -> break } } @@ -25,7 +25,7 @@ fun case_1(value_1: Int): Int { fun case_2(value_1: Int): Int { while (true) { when (value_1) { - 1 -> continue + 1 -> continue 2 -> return 1 } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/11.2.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/11.1.kt similarity index 65% rename from compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/11.2.kt rename to compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/11.1.kt index 4b72f0a2be9..08623a2d5fa 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/11.2.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/11.1.kt @@ -1,11 +1,11 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) * * SPEC VERSION: 0.1-201 * PLACE: expressions, when-expression -> paragraph 6 -> sentence 11 - * NUMBER: 2 + * NUMBER: 1 * DESCRIPTION: 'When' with bound value and not allowed break and continue expression (without labels) in 'when condition'. */ @@ -13,7 +13,7 @@ fun case_1(value_1: Int): String { while (true) { when (value_1) { - break -> return "" + break -> return "" } } @@ -24,7 +24,7 @@ fun case_1(value_1: Int): String { fun case_2(value_1: Int): String { while (true) { when (value_1) { - continue -> return "" + continue -> return "" } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/testsMap.json index 5b4f871b8c7..ac978e8b637 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/testsMap.json @@ -9,34 +9,6 @@ "unexpectedBehaviour": false } ], - "11": [ - { - "specVersion": "0.1-201", - "casesNumber": 2, - "description": "\u0027When\u0027 with bound value and not allowed break and continue expression (without labels) in \u0027when condition\u0027.", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-201", - "casesNumber": 2, - "description": "\u0027When\u0027 with bound value and non-expressions in \u0027when condition\u0027.", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "When", - "path": "compiler/testData/diagnostics/tests/when/When.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Redundant else", - "path": "compiler/testData/diagnostics/tests/when/RedundantElse.kt", - "unexpectedBehaviour": false - } - ], "1": [ { "specVersion": "0.1-100", @@ -51,49 +23,49 @@ "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When type disjunctions", "path": "compiler/testData/diagnostics/tests/when/WhenTypeDisjunctions.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Branch bypass val", "path": "compiler/testData/diagnostics/tests/when/BranchBypassVal.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When", "path": "compiler/testData/diagnostics/tests/when/When.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Branch bypass var", "path": "compiler/testData/diagnostics/tests/when/BranchBypassVar.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive enum mixed", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive enum is", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveEnumIs.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Top level sealed", "path": "compiler/testData/diagnostics/tests/when/TopLevelSealed.kt", @@ -114,7 +86,7 @@ "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When", "path": "compiler/testData/diagnostics/tests/when/When.kt", @@ -129,30 +101,52 @@ "unexpectedBehaviour": false } ], - "5": [ + "11": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-201", + "casesNumber": 2, + "description": "\u0027When\u0027 with bound value and non-expressions in \u0027when condition\u0027.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", "casesNumber": 0, "description": "When", "path": "compiler/testData/diagnostics/tests/when/When.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Redundant else", + "path": "compiler/testData/diagnostics/tests/when/RedundantElse.kt", + "unexpectedBehaviour": false + } + ], + "5": [ + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "When", + "path": "compiler/testData/diagnostics/tests/when/When.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", "casesNumber": 0, "description": "Empty condition with expression enum", "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpressionEnum.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive enum mixed", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Empty condition with expression", "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpression.kt", @@ -161,7 +155,7 @@ ], "9": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When", "path": "compiler/testData/diagnostics/tests/when/When.kt", @@ -170,14 +164,14 @@ ], "10": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When", "path": "compiler/testData/diagnostics/tests/when/When.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Redundant else", "path": "compiler/testData/diagnostics/tests/when/RedundantElse.kt", @@ -220,21 +214,21 @@ "unexpectedBehaviour": true }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Branch false bypass", "path": "compiler/testData/diagnostics/tests/when/BranchFalseBypass.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Branch false bypass else", "path": "compiler/testData/diagnostics/tests/when/BranchFalseBypassElse.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10809", "path": "compiler/testData/diagnostics/tests/when/kt10809.kt", @@ -277,23 +271,31 @@ "unexpectedBehaviour": false } ], + "11": [ + { + "specVersion": "0.1-201", + "casesNumber": 2, + "description": "\u0027When\u0027 with bound value and not allowed break and continue expression (without labels) in \u0027when condition\u0027.", + "unexpectedBehaviour": false + } + ], "5": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Annotated when statement", "path": "compiler/testData/diagnostics/tests/when/AnnotatedWhenStatement.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt4434", "path": "compiler/testData/diagnostics/tests/when/kt4434.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive initialization", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveInitialization.kt", @@ -322,14 +324,14 @@ "neg": { "1": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Empty condition with expression enum", "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpressionEnum.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Empty condition with expression", "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpression.kt", @@ -338,14 +340,14 @@ ], "2": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Empty condition with expression enum", "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpressionEnum.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Empty condition with expression", "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpression.kt", @@ -406,27 +408,21 @@ ], "1": [ { - "specVersion": "0.1-100", - "casesNumber": 2, - "description": "Forbidden break and continue in the control structure body of when.", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When and lambda with expected type", "path": "compiler/testData/diagnostics/tests/when/whenAndLambdaWithExpectedType.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Reserved exhaustive when", "path": "compiler/testData/diagnostics/tests/when/ReservedExhaustiveWhen.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When with nothing and lambdas", "path": "compiler/testData/diagnostics/tests/when/whenWithNothingAndLambdas.kt", @@ -435,7 +431,7 @@ ], "5": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "When", "path": "compiler/testData/diagnostics/tests/when/When.kt", @@ -467,33 +463,39 @@ "1": [ { "specVersion": "0.1-100", - "casesNumber": 25, - "description": "When without bound value, various expressions in the control structure body.", + "casesNumber": 2, + "description": "Allowed break and continue in the control structure body of when.", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-100", + "casesNumber": 25, + "description": "When without bound value, various expressions in the control structure body.", + "unexpectedBehaviour": true + }, + { + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10811", "path": "compiler/testData/diagnostics/tests/when/kt10811.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt9972", "path": "compiler/testData/diagnostics/tests/when/kt9972.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Comma in when condition without argument", "path": "compiler/testData/diagnostics/tests/when/CommaInWhenConditionWithoutArgument.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10809", "path": "compiler/testData/diagnostics/tests/when/kt10809.kt", @@ -502,7 +504,7 @@ ], "4": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Duplicated labels", "path": "compiler/testData/diagnostics/tests/when/DuplicatedLabels.kt", @@ -511,7 +513,7 @@ ], "5": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Duplicated labels", "path": "compiler/testData/diagnostics/tests/when/DuplicatedLabels.kt", @@ -521,459 +523,452 @@ } }, "5": { - "neg": { - "1": [ - { - "specVersion": "0.1-100", - "casesNumber": 2, - "description": "\u0027When\u0027 with bound value and not allowed break and continue expression (without labels) in the control structure body.", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "When type disjunctions", - "path": "compiler/testData/diagnostics/tests/when/WhenTypeDisjunctions.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive boolean nullable", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBooleanNullable.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Non exhaustive warning null", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningNull.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "No else returned unit", - "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedUnit.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "No else expected unit", - "path": "compiler/testData/diagnostics/tests/when/NoElseExpectedUnit.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Branch bypass val", - "path": "compiler/testData/diagnostics/tests/when/BranchBypassVal.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Non exhaustive warning", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarning.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive val over conditional init", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveValOverConditionalInit.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive boolean brackets", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBooleanBrackets.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "When", - "path": "compiler/testData/diagnostics/tests/when/When.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive boolean complex", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBooleanComplex.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "No else returned coercion to unit", - "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Non exhaustive warning false", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningFalse.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Non exhaustive warning for sealed class", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningForSealedClass.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Reserved exhaustive when", - "path": "compiler/testData/diagnostics/tests/when/ReservedExhaustiveWhen.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive boolean", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBoolean.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Branch bypass var", - "path": "compiler/testData/diagnostics/tests/when/BranchBypassVar.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Non exhaustive platform enum", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustivePlatformEnum.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "No else returned from lambda expected int", - "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedFromLambdaExpectedInt.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive var over conditional init", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveVarOverConditionalInit.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Empty condition with expression enum", - "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpressionEnum.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive enum mixed", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Empty condition with expression", - "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpression.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Property not initialized", - "path": "compiler/testData/diagnostics/tests/when/PropertyNotInitialized.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Non exhaustive warning else", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningElse.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Redundant else", - "path": "compiler/testData/diagnostics/tests/when/RedundantElse.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Non exhaustive with nullability check", - "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWithNullabilityCheck.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "No else no expected type", - "path": "compiler/testData/diagnostics/tests/when/NoElseNoExpectedType.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive enum is", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveEnumIs.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "No else returned non unit", - "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedNonUnit.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Exhaustive break continue", - "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBreakContinue.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Top level sealed", - "path": "compiler/testData/diagnostics/tests/when/TopLevelSealed.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Else on nullable enum", - "path": "compiler/testData/diagnostics/tests/when/ElseOnNullableEnum.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Else on nullable enum with smart cast", - "path": "compiler/testData/diagnostics/tests/when/ElseOnNullableEnumWithSmartCast.kt", - "unexpectedBehaviour": false - } - ] - }, "pos": { "1": [ { "specVersion": "0.1-100", - "casesNumber": 25, - "description": "\u0027When\u0027 with bound value and with different variants of expressions in the control structure body.", + "casesNumber": 2, + "description": "\u0027When\u0027 with bound value and allowed break and continue expression (without labels) in the control structure body.", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-100", + "casesNumber": 25, + "description": "\u0027When\u0027 with bound value and with different variants of expressions in the control structure body.", + "unexpectedBehaviour": true + }, + { + "specVersion": "0.1-152", "casesNumber": 0, "description": "Annotated when statement", "path": "compiler/testData/diagnostics/tests/when/AnnotatedWhenStatement.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive platform enum else", "path": "compiler/testData/diagnostics/tests/when/ExhaustivePlatformEnumElse.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", - "casesNumber": 0, - "description": "Kt9929", - "path": "compiler/testData/diagnostics/tests/when/kt9929.kt", - "unexpectedBehaviour": false - }, - { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Branch false bypass", "path": "compiler/testData/diagnostics/tests/when/BranchFalseBypass.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive with nullability check before", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckBefore.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive with nullability check else", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckElse.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt4434", "path": "compiler/testData/diagnostics/tests/when/kt4434.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Duplicated labels", "path": "compiler/testData/diagnostics/tests/when/DuplicatedLabels.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10811", "path": "compiler/testData/diagnostics/tests/when/kt10811.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive platform enum statement", "path": "compiler/testData/diagnostics/tests/when/ExhaustivePlatformEnumStatement.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive platform enum", "path": "compiler/testData/diagnostics/tests/when/ExhaustivePlatformEnum.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Comma in when condition without argument", "path": "compiler/testData/diagnostics/tests/when/CommaInWhenConditionWithoutArgument.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive nullable", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveNullable.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Branch false bypass else", "path": "compiler/testData/diagnostics/tests/when/BranchFalseBypassElse.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive initialization", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveInitialization.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive with nullability check", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheck.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive with nullability check boolean", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveWithNullabilityCheckBoolean.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive platform enum annotated", "path": "compiler/testData/diagnostics/tests/when/ExhaustivePlatformEnumAnnotated.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else when statement", "path": "compiler/testData/diagnostics/tests/when/NoElseWhenStatement.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10809", "path": "compiler/testData/diagnostics/tests/when/kt10809.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10439", "path": "compiler/testData/diagnostics/tests/when/kt10439.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Non exhaustive boolean nullable", "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveBooleanNullable.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive no initialization", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveNoInitialization.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive return throw", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveReturnThrow.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive return", "path": "compiler/testData/diagnostics/tests/when/ExhaustiveReturn.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Exhaustive platform enum null", "path": "compiler/testData/diagnostics/tests/when/ExhaustivePlatformEnumNull.kt", "unexpectedBehaviour": false } ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "When type disjunctions", + "path": "compiler/testData/diagnostics/tests/when/WhenTypeDisjunctions.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive boolean nullable", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBooleanNullable.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive warning null", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningNull.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "No else returned unit", + "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedUnit.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "No else expected unit", + "path": "compiler/testData/diagnostics/tests/when/NoElseExpectedUnit.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Branch bypass val", + "path": "compiler/testData/diagnostics/tests/when/BranchBypassVal.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive warning", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarning.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive val over conditional init", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveValOverConditionalInit.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive boolean brackets", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBooleanBrackets.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "When", + "path": "compiler/testData/diagnostics/tests/when/When.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive boolean complex", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBooleanComplex.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "No else returned coercion to unit", + "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive warning false", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningFalse.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive warning for sealed class", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningForSealedClass.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Reserved exhaustive when", + "path": "compiler/testData/diagnostics/tests/when/ReservedExhaustiveWhen.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive boolean", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBoolean.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Branch bypass var", + "path": "compiler/testData/diagnostics/tests/when/BranchBypassVar.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive platform enum", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustivePlatformEnum.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "No else returned from lambda expected int", + "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedFromLambdaExpectedInt.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive var over conditional init", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveVarOverConditionalInit.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Empty condition with expression enum", + "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpressionEnum.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive enum mixed", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveEnumMixed.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Empty condition with expression", + "path": "compiler/testData/diagnostics/tests/when/EmptyConditionWithExpression.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Property not initialized", + "path": "compiler/testData/diagnostics/tests/when/PropertyNotInitialized.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive warning else", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningElse.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Redundant else", + "path": "compiler/testData/diagnostics/tests/when/RedundantElse.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Non exhaustive with nullability check", + "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWithNullabilityCheck.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "No else no expected type", + "path": "compiler/testData/diagnostics/tests/when/NoElseNoExpectedType.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive enum is", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveEnumIs.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "No else returned non unit", + "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedNonUnit.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Exhaustive break continue", + "path": "compiler/testData/diagnostics/tests/when/ExhaustiveBreakContinue.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Top level sealed", + "path": "compiler/testData/diagnostics/tests/when/TopLevelSealed.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Else on nullable enum", + "path": "compiler/testData/diagnostics/tests/when/ElseOnNullableEnum.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-152", + "casesNumber": 0, + "description": "Else on nullable enum with smart cast", + "path": "compiler/testData/diagnostics/tests/when/ElseOnNullableEnumWithSmartCast.kt", + "unexpectedBehaviour": false + } + ] } }, "9": { "pos": { "2": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Annotated when statement", "path": "compiler/testData/diagnostics/tests/when/AnnotatedWhenStatement.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else when statement", "path": "compiler/testData/diagnostics/tests/when/NoElseWhenStatement.kt", @@ -982,28 +977,28 @@ ], "1": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Duplicated labels", "path": "compiler/testData/diagnostics/tests/when/DuplicatedLabels.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt9972", "path": "compiler/testData/diagnostics/tests/when/kt9972.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10809", "path": "compiler/testData/diagnostics/tests/when/kt10809.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Kt10439", "path": "compiler/testData/diagnostics/tests/when/kt10439.kt", @@ -1014,70 +1009,70 @@ "neg": { "2": [ { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Non exhaustive warning null", "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningNull.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else returned unit", "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedUnit.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else expected unit", "path": "compiler/testData/diagnostics/tests/when/NoElseExpectedUnit.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Non exhaustive warning", "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarning.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else returned coercion to unit", "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedCoercionToUnit.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Non exhaustive warning for sealed class", "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWarningForSealedClass.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else returned from lambda expected int", "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedFromLambdaExpectedInt.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "Non exhaustive with nullability check", "path": "compiler/testData/diagnostics/tests/when/NonExhaustiveWithNullabilityCheck.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else no expected type", "path": "compiler/testData/diagnostics/tests/when/NoElseNoExpectedType.kt", "unexpectedBehaviour": false }, { - "specVersion": "0.1-155", + "specVersion": "0.1-152", "casesNumber": 0, "description": "No else returned non unit", "path": "compiler/testData/diagnostics/tests/when/NoElseReturnedNonUnit.kt", diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/testsMap.json index d61970d06b6..9bd23c6c19c 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1/testsMap.json @@ -62,18 +62,5 @@ } ] } - }, - "5": { - "pos": { - "2": [ - { - "specVersion": "0.1-152", - "casesNumber": 0, - "description": "Kt9929", - "path": "compiler/testData/diagnostics/tests/when/kt9929.kt", - "unexpectedBehaviour": false - } - ] - } } } \ No newline at end of file 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 d028eecbe5c..1460375441f 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 @@ -25,7 +25,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInDiagnostics() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "linked/type-inference", "linked/type-system/type-kinds/type-parameters", "linked/type-system/subtyping", "linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "linked/declarations/classifier-declaration/classifier-initialization", "linked/declarations/function-declaration", "linked/declarations/property-declaration/property-initialization", "linked/annotations", "linked/statements", "linked/inheritance", "linked/expressions/function-literals", "linked/expressions/call-and-property-access-expressions", "linked/overload-resolution", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked") @@ -37,7 +37,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInLinked() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), null, true, "type-inference", "type-system/type-kinds/type-parameters", "type-system/subtyping", "control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions", "declarations/classifier-declaration/classifier-initialization", "declarations/function-declaration", "declarations/property-declaration/property-initialization", "annotations", "statements", "inheritance", "expressions/function-literals", "expressions/call-and-property-access-expressions", "overload-resolution", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis") @@ -49,7 +49,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInControl__and_data_flow_analysis() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis"), Pattern.compile("^(.+)\\.kt$"), null, true, "performing-analysis-on-the-control-flow-graph"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis/control-flow-graph") @@ -171,19 +171,6 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Control__and_data_flow_analysis_control_flow_graph_expressions_1_conditional_expressions extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInControl__and_data_flow_analysis_control_flow_graph_expressions_1_conditional_expressions() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/control--and-data-flow-analysis.control-flow-graph.expressions-1.conditional-expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/declarations") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -193,7 +180,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInDeclarations() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/declarations"), Pattern.compile("^(.+)\\.kt$"), null, true, "classifier-declaration/classifier-initialization", "function-declaration", "property-declaration/property-initialization"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration") @@ -205,7 +192,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInClassifier_declaration() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration"), Pattern.compile("^(.+)\\.kt$"), null, true, "classifier-initialization"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/declarations/classifier-declaration/class-declaration") @@ -407,7 +394,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInProperty_declaration() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration"), Pattern.compile("^(.+)\\.kt$"), null, true, "property-initialization"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration/local-property-declaration") @@ -453,19 +440,6 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration/property-initialization") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Property_initialization extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInProperty_initialization() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/declarations/property-declaration/property-initialization"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } } } @@ -478,7 +452,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInExpressions() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions"), Pattern.compile("^(.+)\\.kt$"), null, true, "function-literals", "call-and-property-access-expressions"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression") @@ -2977,11 +2951,6 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); } - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/1.1.kt"); - } - @TestMetadata("2.1.kt") public void test2_1() throws Exception { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/neg/2.1.kt"); @@ -3010,6 +2979,11 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.1.kt"); } + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/1.2.kt"); + } + @TestMetadata("2.1.kt") public void test2_1() throws Exception { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-2/pos/2.1.kt"); @@ -3123,24 +3097,6 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5"), Pattern.compile("^(.+)\\.kt$"), null, true); } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/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("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg/1.1.kt"); - } - - public void testAllFilesPresentInNeg() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -3154,6 +3110,11 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.1.kt"); } + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos/1.2.kt"); + } + public void testAllFilesPresentInPos() throws Exception { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); } @@ -3185,11 +3146,6 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/11.1.kt"); } - @TestMetadata("11.2.kt") - public void test11_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/11.2.kt"); - } - @TestMetadata("12.1.kt") public void test12_1() throws Exception { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/neg/12.1.kt"); @@ -3243,6 +3199,11 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/10.2.kt"); } + @TestMetadata("11.1.kt") + public void test11_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/11.1.kt"); + } + @TestMetadata("12.1.kt") public void test12_1() throws Exception { runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-6/pos/12.1.kt"); @@ -3291,58 +3252,6 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/inheritance") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Inheritance extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInInheritance() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/inheritance"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/inheritance/overriding") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Overriding extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInOverriding() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/inheritance/overriding"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Statements extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInStatements() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Assignments extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInAssignments() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } - } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-system") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -3352,7 +3261,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInType_system() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-system"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-system"), Pattern.compile("^(.+)\\.kt$"), null, true, "type-kinds/type-parameters", "subtyping"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-system/introduction-1") @@ -3454,7 +3363,7 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } public void testAllFilesPresentInType_kinds() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds"), Pattern.compile("^(.+)\\.kt$"), null, true, "type-parameters"); } @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-system/type-kinds/built-in-types") 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 7e2d8b02b51..24c31b7e56a 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.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "templates"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "templates", "linked/statements"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked") @@ -37,7 +37,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } public void testAllFilesPresentInLinked() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), null, true); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), null, true, "statements"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions") @@ -484,11 +484,6 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes 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.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/conditional-expression/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); } @@ -3051,32 +3046,6 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Statements extends AbstractBlackBoxCodegenTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInStatements() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Assignments extends AbstractBlackBoxCodegenTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); - } - - public void testAllFilesPresentInAssignments() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } - } - @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -3350,29 +3319,6 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/neg"), Pattern.compile("^(.+)\\.kt$"), null, 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.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/notLinked/flexibility/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); - } - } } @TestMetadata("compiler/tests-spec/testData/codegen/box/notLinked/objects")