From dcfcc9c7b6ada5eddf3a63eb006dfdc4c1231117 Mon Sep 17 00:00:00 2001 From: "anastasiia.spaseeva" Date: Wed, 18 Dec 2019 13:54:24 +0300 Subject: [PATCH] [Spec tests] Add tests for when-expression (p-3, 4) --- .../p-4/neg/1.1.exceptions.compiletime.txt | 1 + .../when-expression/p-4/neg/1.1.kt | 29 ++++ .../p-4/neg/1.2.exceptions.compiletime.txt | 1 + .../when-expression/p-4/neg/1.2.kt | 19 +++ .../p-4/neg/1.3.exceptions.compiletime.txt | 1 + .../when-expression/p-4/neg/1.3.kt | 20 +++ .../p-4/neg/1.4.exceptions.compiletime.txt | 1 + .../when-expression/p-4/neg/1.4.kt | 28 ++++ .../when-expression/p-4/pos/1.1.kt | 31 ++++ .../when-expression/p-4/pos/1.2.kt | 20 +++ .../when-expression/p-4/pos/1.3.kt | 20 +++ .../when-expression/p-4/pos/1.4.kt | 28 ++++ .../p-5/neg/2.1.exceptions.compiletime.txt | 1 + .../when-expression/p-5/neg/2.1.kt | 32 ++++ .../when-expression/p-5/pos/1.1.kt | 33 ++++ .../expressions/when-expression/testsMap.json | 82 ++++++++++ .../when-expression/p-3/neg/2.1.kt | 54 +++++++ .../when-expression/p-4/neg/1.1.kt | 69 +++++++++ .../when-expression/p-4/pos/1.1.kt | 114 ++++++++++++++ .../expressions/when-expression/testsMap.json | 34 ++++ .../DiagnosticsTestSpecGenerated.java | 84 +++++++++- .../BlackBoxCodegenTestSpecGenerated.java | 145 +++++++++++++++++- 22 files changed, 843 insertions(+), 4 deletions(-) create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.exceptions.compiletime.txt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.exceptions.compiletime.txt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.exceptions.compiletime.txt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.exceptions.compiletime.txt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.2.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.3.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.4.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.exceptions.compiletime.txt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos/1.1.kt create mode 100644 compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/testsMap.json create mode 100644 compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt create mode 100644 compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.exceptions.compiletime.txt new file mode 100644 index 00000000000..6972be13c5d --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'Val_1', 'Val_2' branches or 'else' branch instead (4,17) in /KotlinClass.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.kt new file mode 100644 index 00000000000..5a41ac826c3 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.kt @@ -0,0 +1,29 @@ +// WITH_RUNTIME +// FULL_JDK + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (Enum) + * EXCEPTION: compiletime + */ + + +// FILE: JavaEnum.java +enum JavaEnum { + Val_1, + Val_2, + Val_3, +} + +// FILE: KotlinClass.kt +fun box(): String { + val z = JavaEnum.Val_3 + val when3 = when (z) { + JavaEnum.Val_3 -> { "OK" } + } + return when3 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.exceptions.compiletime.txt new file mode 100644 index 00000000000..fb37ec742e5 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'false' branch or 'else' branch instead (15,17) in /1.2.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.kt new file mode 100644 index 00000000000..a8f3e6f1119 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.kt @@ -0,0 +1,19 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean) + * EXCEPTION: compiletime + */ + +fun box(): String { + val b = true + val when2 = when (b) { + !false -> { "OK" } + } + return when2 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.exceptions.compiletime.txt new file mode 100644 index 00000000000..587a78b0978 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'true' branch or 'else' branch instead (15,17) in /1.3.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.kt new file mode 100644 index 00000000000..000b1599bdf --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean) + * EXCEPTION: compiletime + */ + +fun box(): String { + val a = false + val when2 = when (a) { + false -> { "OK" } + false -> { "NOK" } + } + return when2 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.exceptions.compiletime.txt new file mode 100644 index 00000000000..5aafed7132f --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: NO_ELSE_IN_WHEN: 'when' expression must be exhaustive, add necessary 'is C' branch or 'else' branch instead (22,17) in /1.4.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.kt new file mode 100644 index 00000000000..1c4e02ac522 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (sealed class) + * EXCEPTION: compiletime + */ + +sealed class SClass { + class A : SClass() + class B : SClass() + class C : SClass() +} + +fun box(): String { + val x: SClass = SClass.B() + + val when1 = when (x){ + is SClass.A ->{ "NOK"} + is SClass.B ->{ "OK" } + is SClass.B ->{ "NOK" } + } + return when1 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.1.kt new file mode 100644 index 00000000000..52892d43baf --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.1.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME +// FULL_JDK + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (Enum) + */ + + +// FILE: JavaEnum.java +enum JavaEnum { + Val_1, + Val_2, + Val_3, +} + +// FILE: KotlinClass.kt +fun box(): String { + val z = JavaEnum.Val_3 + val when3 = when (z) { + JavaEnum.Val_1 -> { "NOK" } + JavaEnum.Val_3 -> { "OK" } + JavaEnum.Val_3 -> { "NOK" } + JavaEnum.Val_2 -> { "NOK" } + } + return when3 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.2.kt new file mode 100644 index 00000000000..9a93e94e7ef --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.2.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean) + */ + +fun box(): String { + val b = true + val when2 = when (b) { + false -> { "NOK" } + !false -> { "OK" } + !false -> { "NOK" } + } + return when2 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.3.kt new file mode 100644 index 00000000000..27350c6528f --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.3.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (Boolean) + */ + +fun box(): String { + val a = false + val when2 = when (a) { + true -> { "NOK" } + false -> { "OK" } + false -> { "NOK" } + } + return when2 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.4.kt new file mode 100644 index 00000000000..e31af62ab26 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.4.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 4 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition (sealed class) + */ + +sealed class SClass { + class A : SClass() + class B : SClass() + class C : SClass() +} + +fun box(): String { + val x: SClass = SClass.B() + + val when1 = when (x){ + is SClass.A ->{ "NOK"} + is SClass.B ->{ "OK" } + is SClass.B ->{ "NOK" } + is SClass.C ->{ "NOK" } + } + return when1 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.exceptions.compiletime.txt new file mode 100644 index 00000000000..33b0cb4c961 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: ELSE_MISPLACED_IN_WHEN: 'else' entry must be the last one in a when-expression (6,9) in /KotlinClass.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.kt new file mode 100644 index 00000000000..84f34eedf5e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME +// FULL_JDK + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 5 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: The else condition is a special condition which evaluates to true if none of the branches above it evaluated to true. + * EXCEPTION: compiletime + */ + + +// FILE: JavaEnum.java +enum JavaEnum { + Val_1, + Val_2, + Val_3, +} + +// FILE: KotlinClass.kt +fun box(): String { + val z = JavaEnum.Val_3 + val when1 = when (z) { + JavaEnum.Val_1 -> { false } + else -> {true} + JavaEnum.Val_2 -> { false } + } + + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos/1.1.kt new file mode 100644 index 00000000000..891a9247a27 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos/1.1.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME +// FULL_JDK + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error. + */ + + +// FILE: JavaEnum.java +enum JavaEnum { + Val_1, + Val_2, + Val_3, +} + +// FILE: KotlinClass.kt +fun box(): String { + val z = JavaEnum.Val_3 + val when1 = when (z) { + JavaEnum.Val_1 -> { false } + else -> {true} + } + val when2 = when (z) { + JavaEnum.Val_3 -> { true } + else -> {false} + } + return if (when1 && when2) "OK" else "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/testsMap.json new file mode 100644 index 00000000000..0374ea32975 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/testsMap.json @@ -0,0 +1,82 @@ +{ + "4": { + "neg": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": " it is possible to replace the else condition with an always-true condition (Boolean)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": " it is possible to replace the else condition with an always-true condition (Boolean)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": " it is possible to replace the else condition with an always-true condition (sealed class)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "it is possible to replace the else condition with an always-true condition (Enum)", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": " it is possible to replace the else condition with an always-true condition (Boolean)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": " it is possible to replace the else condition with an always-true condition (Boolean)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": " it is possible to replace the else condition with an always-true condition (sealed class)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "it is possible to replace the else condition with an always-true condition (Enum)", + "unexpectedBehaviour": false + } + ] + } + }, + "5": { + "neg": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "The else condition is a special condition which evaluates to true if none of the branches above it evaluated to true.", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 0, + "description": "The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error.", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.kt new file mode 100644 index 00000000000..b96552ab7b8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.kt @@ -0,0 +1,54 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 3 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error + */ + +// FILE: JavaEnum.java +enum JavaEnum { + Val_1, + Val_2, + Val_3, +} + +// FILE: KotlinClass.kt + + +// TESTCASE NUMBER: 1 + +fun case1() { + val z = JavaEnum.Val_3 + val when1 = when (z) { + JavaEnum.Val_1 -> { false } + else -> {true} + JavaEnum.Val_2 -> { false } + } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + val z = JavaEnum.Val_3 + val when1 = when (z) { + else -> {true} + JavaEnum.Val_1 -> { false } + JavaEnum.Val_2 -> { false } + } +}// TESTCASE NUMBER: 3 + +fun case3() { + val z = JavaEnum.Val_3 + val when1 = when (z) { + else -> {true} + JavaEnum.Val_1 -> { false } + JavaEnum.Val_2 -> { false } + else -> { true } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt new file mode 100644 index 00000000000..549bf137029 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg/1.1.kt @@ -0,0 +1,69 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT +// FULL_JDK + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition + */ + +// FILE: JavaEnum.java + +enum JavaEnum { + Val_1, + Val_2, +} + +// FILE: KotlinClass.kt + +// TESTCASE NUMBER: 1 +fun case1() { + val z = JavaEnum.Val_1 + val when2 = when (z) { + JavaEnum.Val_1 -> { } + JavaEnum.Val_1 -> { } + } + +} + +// TESTCASE NUMBER: 2 + +fun case2() { + val b = false + val when2: Any = when (b) { + false -> { } + false -> { } + } +} + +// TESTCASE NUMBER: 3 + +fun case3() { + val a = false + val when2: Any = when (a) { + true -> { } + true -> { } + } +} + +// TESTCASE NUMBER: 4 + +fun case4() { + val x: SClass = SClass.B() + val when2 = when (x){ + is SClass.A ->{ } + is SClass.B ->{ } + is SClass.B ->{ } + } +} + +sealed class SClass { + class A : SClass() + class B : SClass() + class C : SClass() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.kt new file mode 100644 index 00000000000..468c97460b5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos/1.1.kt @@ -0,0 +1,114 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT +// FULL_JDK + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-218 + * PLACE: expressions, when-expression -> paragraph 4 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: it is possible to replace the else condition with an always-true condition + */ + +// FILE: JavaEnum.java + +enum JavaEnum { + Val_1, + Val_2, +} + +// FILE: KotlinClass.kt + +// TESTCASE NUMBER: 1 +fun case1() { + val z = JavaEnum.Val_1 + val when1 = when (z) { + JavaEnum.Val_1 -> { } + JavaEnum.Val_2 -> { } + else -> {} + } + + val when2 = when (z) { + JavaEnum.Val_1 -> { } + JavaEnum.Val_2 -> { } + } + val when3 = when (z) { + JavaEnum.Val_1 -> { } + JavaEnum.Val_2 -> { } + JavaEnum.Val_2 -> { } + } +} + +// TESTCASE NUMBER: 2 + +fun case2() { + val b = false + val when1: Any = when (b) { + false -> { } + !false -> { } + else -> { } + } + + val when2: Any = when (b) { + false -> { } + !false -> { } + } + val when3: Any = when (b) { + false -> { } + false -> { } + !false -> { } + } +} + +// TESTCASE NUMBER: 3 + +fun case3() { + val a = false + val when1: Any = when (a) { + true -> { } + false -> { } + else -> { } + } + val when2: Any = when (a) { + true -> { } + false -> { } + } + val when3: Any = when (a) { + true -> { } + false -> { } + false -> { } + } +} + +// TESTCASE NUMBER: 4 + +fun case4() { + val x: SClass = SClass.B() + + val when1 = when (x){ + is SClass.A ->{ } + is SClass.B ->{ } + is SClass.C ->{ } + else -> { } + } + + val when2 = when (x){ + is SClass.A ->{ } + is SClass.B ->{ } + is SClass.C ->{ } + } + val when3 = when (x){ + is SClass.A ->{ } + is SClass.B ->{ } + is SClass.B ->{ } + is SClass.C ->{ } + } +} + +sealed class SClass { + class A : SClass() + class B : SClass() + class C : SClass() +} \ No newline at end of file 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 112a264ee91..cff0bc8e7e7 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 @@ -151,6 +151,40 @@ ] } }, + "4": { + "neg": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 4, + "description": " it is possible to replace the else condition with an always-true condition", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 4, + "description": " it is possible to replace the else condition with an always-true condition", + "unexpectedBehaviour": false + } + ] + } + }, + "3": { + "neg": { + "2": [ + { + "specVersion": "0.1-218", + "casesNumber": 2, + "description": "The else condition must also be in the last when entry of when expression, otherwise it is a compile-time error", + "unexpectedBehaviour": false + } + ] + } + }, "2": { "neg": { "2": [ 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 88234eef058..76157bc250f 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.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), 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/annotations", "linked/statements", "linked/inheritance", "linked/expressions.conditional-expression", "linked/expressions/function-literals", "linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "linked/overload-resolution", "linked/control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "linked/type-inference", "linked/expressions.when-expression", "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/annotations", "linked/statements", "linked/inheritance", "linked/expressions.conditional-expression", "linked/expressions/function-literals", "linked/expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "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.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), 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", "annotations", "statements", "inheritance", "expressions.conditional-expression", "expressions/function-literals", "expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "overload-resolution", "control--and-data-flow-analysis/performing-analysis-on-the-control-flow-graph"); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked"), Pattern.compile("^(.+)\\.kt$"), true, "type-inference", "expressions.when-expression", "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", "annotations", "statements", "inheritance", "expressions.conditional-expression", "expressions/function-literals", "expressions/built-in-types-and-their-semantics/kotlin.nothing-1/p-1/neg", "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") @@ -2058,6 +2058,86 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg/2.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_4 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_4() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/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-4/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos 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-4/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-4/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/p-5") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java index 63bc29b6cb0..546a4cf16d1 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/spec/codegen/BlackBoxCodegenTestSpecGenerated.java @@ -25,7 +25,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } public void testAllFilesPresentInBox() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "linked/statements", "linked/expressions.conditional-expression", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "linked/expressions/prefix-expressions/prefix-increment-expression/p-1/neg"); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), true, "helpers", "templates", "linked/expressions.when-expression", "linked/statements", "linked/expressions.conditional-expression", "linked/expressions/equality-expressions/reference-equality-expressions/p-1/neg", "linked/expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "linked/expressions/prefix-expressions/prefix-increment-expression/p-1/neg"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked") @@ -37,7 +37,7 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } public void testAllFilesPresentInLinked() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), true, "statements", "expressions.conditional-expression", "expressions/equality-expressions/reference-equality-expressions/p-1/neg", "expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "expressions/prefix-expressions/prefix-increment-expression/p-1/neg"); + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), true, "expressions.when-expression", "statements", "expressions.conditional-expression", "expressions/equality-expressions/reference-equality-expressions/p-1/neg", "expressions/built-in-types-and-their-semantics/kotlin.unit/p-1/neg", "expressions/prefix-expressions/prefix-increment-expression/p-1/neg"); } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions") @@ -1480,6 +1480,147 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class When_expression extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInWhen_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_4 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_4() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg/1.4.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos/1.4.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-4/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_5 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_5() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5"), Pattern.compile("^(.+)\\.kt$"), true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg/2.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/neg"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/when-expression/p-5/pos"), Pattern.compile("^(.+)\\.kt$"), true); + } + } + } + } } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system")