diff --git a/compiler/testData/diagnostics/tests/callableReference/bareType.kt b/compiler/testData/diagnostics/tests/callableReference/bareType.kt index 669f4f1c27c..46df2d7d6d8 100644 --- a/compiler/testData/diagnostics/tests/callableReference/bareType.kt +++ b/compiler/testData/diagnostics/tests/callableReference/bareType.kt @@ -1,3 +1,7 @@ +/* + * RELEVANT SPEC SENTENCES (spec version: 0.1-220, test type: pos): + * - expressions, call-and-property-access-expressions, callable-references -> paragraph 3 -> sentence 1 + */ fun f1() = Map::hashCode fun f2() = Map.Entry::hashCode diff --git a/compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt b/compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt index 325d94a202b..e31bf9e397d 100644 --- a/compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt +++ b/compiler/testData/diagnostics/tests/callableReference/callableReferenceAsLastExpressionInBlock.kt @@ -1,6 +1,9 @@ // !DIAGNOSTICS: -UNUSED_VARIABLE // !CHECK_TYPE - +/* + * RELEVANT SPEC SENTENCES (spec version: 0.1-220, test type: pos): + * - expressions, call-and-property-access-expressions, callable-references -> paragraph 11 -> sentence 3 + */ import kotlin.reflect.KFunction0 fun test() { diff --git a/compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt b/compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt index 00a027a90c7..d2026f0a6bf 100644 --- a/compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt +++ b/compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt @@ -1,6 +1,10 @@ // !LANGUAGE: +NewInference // !DIAGNOSTICS: -UNUSED_PARAMETER - +/* + * RELEVANT SPEC SENTENCES (spec version: 0.1-220, test type: pos): + * - expressions, call-and-property-access-expressions, navigation-operators -> paragraph 9 -> sentence 2 + * - expressions, call-and-property-access-expressions, navigation-operators -> paragraph 8 -> sentence 1 + */ import kotlin.reflect.KProperty1 class DTO { diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/1.1.kt index decd16c671a..152bbef5f49 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/1.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/1.1.kt @@ -8,6 +8,7 @@ * RELEVANT PLACES: expressions, additive-expression -> paragraph 1 -> sentence 1 * expressions, additive-expression -> paragraph 1 -> sentence 2 * expressions, additive-expression -> paragraph 3 -> sentence 1 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: A + B is exactly the same as A.plus(B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/2.1.kt index da261418331..b15acd3ddc4 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/2.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/additive-expression/p-2/pos/2.1.kt @@ -8,6 +8,7 @@ * RELEVANT PLACES: expressions, additive-expression -> paragraph 1 -> sentence 1 * expressions, additive-expression -> paragraph 1 -> sentence 2 * expressions, additive-expression -> paragraph 3 -> sentence 1 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: A - B is exactly the same as A.MINUS(B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.1.kt index 47172f859d9..90491d398f8 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.1.kt @@ -9,6 +9,7 @@ * expressions, comparison-expressions -> paragraph 2 -> sentence 1 * expressions, comparison-expressions -> paragraph 3 -> sentence 1 * expressions, comparison-expressions -> paragraph 4 -> sentence 1 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: These operators are overloadable (A < B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.2.kt index 57110f07e7e..e561be1a42a 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.2.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.2.kt @@ -9,6 +9,7 @@ * expressions, comparison-expressions -> paragraph 2 -> sentence 2 * expressions, comparison-expressions -> paragraph 3 -> sentence 1 * expressions, comparison-expressions -> paragraph 4 -> sentence 1 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 2 * DESCRIPTION: These operators are overloadable (A > B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.3.kt index 97794d7a9d5..5853913a75a 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.3.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.3.kt @@ -9,6 +9,7 @@ * expressions, comparison-expressions -> paragraph 2 -> sentence 3 * expressions, comparison-expressions -> paragraph 3 -> sentence 1 * expressions, comparison-expressions -> paragraph 4 -> sentence 1 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 3 * DESCRIPTION: These operators are overloadable (A <= B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.4.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.4.kt index be31923b31c..c550e43cc00 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.4.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/comparison-expressions/p-1/pos/2.4.kt @@ -9,6 +9,7 @@ * expressions, comparison-expressions -> paragraph 2 -> sentence 3 * expressions, comparison-expressions -> paragraph 3 -> sentence 1 * expressions, comparison-expressions -> paragraph 4 -> sentence 1 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 4 * DESCRIPTION: These operators are overloadable (A >= B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.1.kt new file mode 100644 index 00000000000..46e6e3ab5a3 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.1.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, break-expression -> paragraph 3 -> sentence 1 + * RELEVANT PLACES: expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, break-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A simple break expression, specified using the break keyword, which break-jumps to the innermost loop statement in the current scope + */ + +fun box(): String { + val inputList = listOf(1, 2, 3) + var list1 = mutableListOf() + for (it in listOf(1, 2, 3)){ + for (it1 in listOf("1.", "2.", "3.")) { + if (true) break + } + list1.add(it) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.2.kt new file mode 100644 index 00000000000..e97223e83cf --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, break-expression -> paragraph 3 -> sentence 1 + * RELEVANT PLACES: expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, break-expression -> paragraph 2 -> sentence 1 + * statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: A simple break expression, specified using the continue keyword, which break-jumps to the innermost loop statement in the current scope + */ + +fun box(): String { + val inputList = listOf(0, 1, 2) + var x = 0 + var y = 0 + var list1 = mutableListOf() + while (x < 3) { + while (y< 3) { + y++ + if (true) break + } + list1.add(x++) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.1.kt new file mode 100644 index 00000000000..464b461dab8 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.1.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, break-expression -> paragraph 3 -> sentence 2 + * RELEVANT PLACES: expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, break-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A labeled break expression, denoted break@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L. + */ + +fun box() : String{ + val inputList = listOf(1, 2, 3) + var list1 = mutableListOf() + for (it in listOf(1, 2, 3)) { + label@ for (it1 in listOf("1.", "2.", "3.")) { + if (true) break@label + } + list1.add(it) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.2.kt new file mode 100644 index 00000000000..f5009964fc2 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, break-expression -> paragraph 3 -> sentence 2 + * RELEVANT PLACES: expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, break-expression -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A labeled break expression, denoted break@Loop, where Loop is a label of a labeled loop statement L, which break-jumps to the loop L. + */ + + +fun box(): String { + val inputList = listOf(0, 1, 2) + var x = 0 + var y = 0 + var list1 = mutableListOf() + while (x < 3) { + label@ while (y< 3) { + y++ + if (true) break@label + } + list1.add(x++) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/testsMap.json new file mode 100644 index 00000000000..5b05f5e261e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/testsMap.json @@ -0,0 +1,68 @@ +{ + "3": { + "pos": { + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled break expression, denoted break@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled break expression, denoted break@Loop, where Loop is a label of a labeled loop statement L, which break-jumps to the loop L.", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple break expression, specified using the continue keyword, which break-jumps to the innermost loop statement in the current scope", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple break expression, specified using the break keyword, which break-jumps to the innermost loop statement in the current scope", + "unexpectedBehaviour": false + } + ] + } + }, + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled break expression, denoted break@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple break expression, specified using the continue keyword, which break-jumps to the innermost loop statement in the current scope", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled break expression, denoted break@Loop, where Loop is a label of a labeled loop statement L, which break-jumps to the loop L.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple break expression, specified using the break keyword, which break-jumps to the innermost loop statement in the current scope", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.1.kt new file mode 100644 index 00000000000..c9c8f6d074b --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.1.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, continue-expression -> paragraph 3 -> sentence 1 + * RELEVANT PLACES: expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, continue-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A simple continue expression, specified using the continue keyword, which continue-jumps to the innermost loop statement in the current scope + */ + +fun box(): String { + val inputList = listOf(1, 2, 3) + var list1 = mutableListOf() + for (it in listOf(1, 2, 3)){ + for (it1 in listOf("1.", "2.", "3.")) { + if (true) continue + } + list1.add(it) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.2.kt new file mode 100644 index 00000000000..5bff76d0385 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.2.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, continue-expression -> paragraph 3 -> sentence 1 + * RELEVANT PLACES: expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, continue-expression -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A simple continue expression, specified using the continue keyword, which continue-jumps to the innermost loop statement in the current scope + */ + +fun box(): String { + val inputList = listOf(0, 1, 2) + var x = 0 + var y = 0 + var list1 = mutableListOf() + while (x < 3) { + while (y< 3) { + y++ + if (true) continue + } + list1.add(x++) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.1.kt new file mode 100644 index 00000000000..35c7d3850f4 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.1.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, continue-expression -> paragraph 3 -> sentence 2 + * RELEVANT PLACES: expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, continue-expression -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A labeled continue expression, denoted continue@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L. + */ + +fun box() : String{ + val inputList = listOf(1, 2, 3) + var list1 = mutableListOf() + for (it in listOf(1, 2, 3)) { + label@ for (it1 in listOf("1.", "2.", "3.")) { + if (true) continue@label + } + list1.add(it) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.2.kt new file mode 100644 index 00000000000..263553ac7e4 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, continue-expression -> paragraph 3 -> sentence 2 + * RELEVANT PLACES: expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 1 + * expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, continue-expression -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A labeled continue expression, denoted continue@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L. + */ + + +fun box(): String { + val inputList = listOf(0, 1, 2) + var x = 0 + var y = 0 + var list1 = mutableListOf() + while (x < 3) { + label@ while (y< 3) { + y++ + if (true) continue@label + } + list1.add(x++) + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/testsMap.json new file mode 100644 index 00000000000..604d76502c6 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/testsMap.json @@ -0,0 +1,68 @@ +{ + "3": { + "pos": { + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled continue expression, denoted continue@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled continue expression, denoted continue@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L.", + "unexpectedBehaviour": false + } + ], + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple continue expression, specified using the continue keyword, which continue-jumps to the innermost loop statement in the current scope", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple continue expression, specified using the continue keyword, which continue-jumps to the innermost loop statement in the current scope", + "unexpectedBehaviour": false + } + ] + } + }, + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled continue expression, denoted continue@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple continue expression, specified using the continue keyword, which continue-jumps to the innermost loop statement in the current scope", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A labeled continue expression, denoted continue@Loop, where Loop is a label of a labeled loop statement L, which continue-jumps to the loop L.", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A simple continue expression, specified using the continue keyword, which continue-jumps to the innermost loop statement in the current scope", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt new file mode 100644 index 00000000000..20291daf74e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt @@ -0,0 +1,28 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1 + * RELEVANT PLACES: expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: + */ + +fun box(): String { + try { + fooCase1() + }catch (e: NotImplementedError){ + return "NOK" + } + return "OK" +} + +class Case1 + +fun fooCase1(): Case1 { + val x = Case1() + return x + TODO() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.2.kt new file mode 100644 index 00000000000..8d6a4cb6bb5 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.2.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1 + * RELEVANT PLACES: expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: + */ +val flag = false + +fun box(): String { + try { + fooCase1() + } catch (e: NotImplementedError) { + return "NOK" + } + if (flag) + return "NOK" + return "OK" +} + +class Case1 + +fun fooCase1(): Case1 { + val x = Case1() + return x + flag = true + TODO() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.3.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.3.kt new file mode 100644 index 00000000000..30d7070e1bc --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.3.kt @@ -0,0 +1,26 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1 + * RELEVANT PLACES: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 2 + * expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: + */ +val flag = false +fun box() : String{ + val x = foo() + if (x is kotlin.Unit && !flag) + return "OK" + return "NOK" +} + +fun foo() { + return + 1 + flag = true + val x = "" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/2.1.kt new file mode 100644 index 00000000000..77eca60906e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/2.1.kt @@ -0,0 +1,27 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 2 + * RELEVANT PLACES: expressions, jump-expressions, return-expressions -> paragraph 2 -> sentence 1 + * expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 3 + * expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If several declarations match one name, the return is considered to be from the nearest matching function; + */ + +fun box(): String { + val inputList = listOf(1, 2, 3) + var list1 = mutableListOf() + inputList.forEach mark@{ + list1.add(it) + listOf("1.", "2.", "3.").forEach mark@{ + if (true) return@mark + } + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/3.1.kt new file mode 100644 index 00000000000..8ad3d7e96c7 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/3.1.kt @@ -0,0 +1,30 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-300 + * PLACE: expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 3 + * RELEVANT PLACES: expressions, jump-expressions, return-expressions -> paragraph 2 -> sentence 1 + * expressions, jump-expressions, return-expressions -> paragraph 3 -> sentence 2 + * expressions, jump-expressions, return-expressions -> paragraph 5 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If return@Context is inside a lambda expression body, the name of the function using this lambda expression as its argument may be used as Context to refer to the lambda literal itself + */ + +fun box(): String { + val inputList = listOf(1, 2, 3) + var list1 = mutableListOf() + inputList.forEach { + list1.add(it) + listOf("1.", "2.", "3.").forEach { + if (true) return@forEach + } + } + if (list1.containsAll(inputList)) + return "OK" + else return "NOK" + +} + + diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/testsMap.json new file mode 100644 index 00000000000..8298e38e4fa --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/testsMap.json @@ -0,0 +1,95 @@ +{ + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.3.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "5": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "3": { + "pos": { + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If several declarations match one name, the return is considered to be from the nearest matching function;", + "unexpectedBehaviour": false + } + ], + "3": [ + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "If return@Context is inside a lambda expression body, the name of the function using this lambda expression as its argument may be used as Context to refer to the lambda literal itself", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If several declarations match one name, the return is considered to be from the nearest matching function;", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "If return@Context is inside a lambda expression body, the name of the function using this lambda expression as its argument may be used as Context to refer to the lambda literal itself", + "path": "compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/3.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/1.1.kt index 8a367ba3a59..41bbf01b4cc 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/1.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/1.1.kt @@ -7,6 +7,7 @@ * PLACE: expressions, multiplicative-expression -> paragraph 2 -> sentence 1 * RELEVANT PLACES: expressions, multiplicative-expression -> paragraph 1 -> sentence 1 * expressions, multiplicative-expression -> paragraph 1 -> sentence 2 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: A * B is exactly the same as A.times(B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/2.1.kt index faae5d9f4ff..503c2f949ff 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/2.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/2.1.kt @@ -7,6 +7,7 @@ * PLACE: expressions, multiplicative-expression -> paragraph 2 -> sentence 2 * RELEVANT PLACES: expressions, multiplicative-expression -> paragraph 1 -> sentence 1 * expressions, multiplicative-expression -> paragraph 1 -> sentence 2 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: A / B is exactly the same as A.div(B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/3.1.kt index 6e53a0c7b00..2a4b550096e 100644 --- a/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/3.1.kt +++ b/compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/3.1.kt @@ -7,6 +7,7 @@ * PLACE: expressions, multiplicative-expression -> paragraph 2 -> sentence 3 * RELEVANT PLACES: expressions, multiplicative-expression -> paragraph 1 -> sentence 1 * expressions, multiplicative-expression -> paragraph 1 -> sentence 2 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: A % B is exactly the same as A.rem(B) */ diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.exceptions.compiletime.txt new file mode 100644 index 00000000000..3fad7901717 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.exceptions.compiletime.txt @@ -0,0 +1,3 @@ +java.lang.IllegalStateException: ASSIGN_OPERATOR_AMBIGUITY: Assignment operators ambiguity: +public final operator fun plus(value: Int): B defined in B +public final operator fun plusAssign(value: Int): Unit defined in B (31,7) in /1.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt new file mode 100644 index 00000000000..bac922b186e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: A += B is exactly the same as A.plusAssign(B) or A = A.plus(B) (applied in order) + * EXCEPTION: compiletime + */ + +class B(var a: Int) { + var plus = false + var plusAssign = false + + operator fun plus(value: Int): B { + plus = true + return B(a + value) + } + + operator fun plusAssign(value: Int) { + plusAssign = true + a = a + value + } +} + +fun box() { + var b = B(1) + b += 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.exceptions.compiletime.txt new file mode 100644 index 00000000000..a61615eddf2 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /1.2.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.kt new file mode 100644 index 00000000000..c8aefa286e5 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 2 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 3 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A += B is exactly the same as A.plusAssign(B) or A = A.plus(B) (applied in order) + * EXCEPTION: compiletime + */ + + +class B(var a: Int) { + var plus = false + var plusAssign = false + + operator fun plus(value: Int): B { + plus = true + return B(a + value) + } + +} + +fun box() { + val b = B(1) + b += 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.exceptions.compiletime.txt new file mode 100644 index 00000000000..3d8e951a34f --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.exceptions.compiletime.txt @@ -0,0 +1,3 @@ +java.lang.IllegalStateException: ASSIGN_OPERATOR_AMBIGUITY: Assignment operators ambiguity: +public final operator fun div(value: Int): B defined in B +public final operator fun divAssign(value: Int): Unit defined in B (31,7) in /10.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.kt new file mode 100644 index 00000000000..48209132ecf --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 10 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 11 + * NUMBER: 1 + * DESCRIPTION: A /= B is exactly the same as A.divAssign(B) or A = A.div(B) (applied in order) + * EXCEPTION: compiletime + */ + +class B(var a: Int) { + var div = false + var divAssign = false + + operator fun div(value: Int): B { + div = true + return B(a / value) + } + + operator fun divAssign(value: Int) { + divAssign = true + a = a / value + } +} + +fun box() { + var b = B(1) + b /= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.exceptions.compiletime.txt new file mode 100644 index 00000000000..a8aba28fe36 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /10.2.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.kt new file mode 100644 index 00000000000..420f61812cf --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 10 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 11 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 12 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A /= B is exactly the same as A.divAssign(B) or A = A.div(B) (applied in order) + * EXCEPTION: compiletime + */ + + +class B(var a: Int) { + var div = false + var divAssign = false + + operator fun div(value: Int): B { + div = true + return B(a / value) + } + +} + +fun box() { + val b = B(1) + b /= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.exceptions.compiletime.txt new file mode 100644 index 00000000000..63b29f0e913 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.exceptions.compiletime.txt @@ -0,0 +1,3 @@ +java.lang.IllegalStateException: ASSIGN_OPERATOR_AMBIGUITY: Assignment operators ambiguity: +public final operator fun rem(value: Int): B defined in B +public final operator fun remAssign(value: Int): Unit defined in B (31,7) in /13.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.kt new file mode 100644 index 00000000000..da9fdf1d030 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 13 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 14 + * NUMBER: 1 + * DESCRIPTION: A %= B is exactly the same as A.remAssign(B) or A = A.rem(B) (applied in order) + * EXCEPTION: compiletime + */ + +class B(var a: Int) { + var rem = false + var remAssign = false + + operator fun rem(value: Int): B { + rem = true + return B(a % value) + } + + operator fun remAssign(value: Int) { + remAssign = true + a = a % value + } +} + +fun box() { + var b = B(1) + b %= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.exceptions.compiletime.txt new file mode 100644 index 00000000000..a3c975b21ce --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /13.2.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.kt new file mode 100644 index 00000000000..7daefbf1c6c --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 13 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 14 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 15 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A %= B is exactly the same as A.remAssign(B) or A = A.rem(B) (applied in order) + * EXCEPTION: compiletime + */ + + +class B(var a: Int) { + var rem = false + var remAssign = false + + operator fun rem(value: Int): B { + rem = true + return B(a % value) + } + +} + +fun box() { + val b = B(1) + b %= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.exceptions.compiletime.txt new file mode 100644 index 00000000000..ae4d0daf638 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.exceptions.compiletime.txt @@ -0,0 +1,3 @@ +java.lang.IllegalStateException: ASSIGN_OPERATOR_AMBIGUITY: Assignment operators ambiguity: +public final operator fun minus(value: Int): B defined in B +public final operator fun minusAssign(value: Int): Unit defined in B (31,7) in /4.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.kt new file mode 100644 index 00000000000..8bb44fcb08e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 4 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 5 + * NUMBER: 1 + * DESCRIPTION: A -= B is exactly the same as A.minusAssign(B) or A = A.minus(B) (applied in order) + * EXCEPTION: compiletime + */ + +class B(var a: Int) { + var minus = false + var minusAssign = false + + operator fun minus(value: Int): B { + minus = true + return B(a - value) + } + + operator fun minusAssign(value: Int) { + minusAssign = true + a = a - value + } +} + +fun box() { + var b = B(1) + b -= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.exceptions.compiletime.txt new file mode 100644 index 00000000000..ee75b4fbee8 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /4.2.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.kt new file mode 100644 index 00000000000..231172a54a1 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 4 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 5 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 6 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A -= B is exactly the same as A.minusAssign(B) or A = A.minus(B) (applied in order) + * EXCEPTION: compiletime + */ + + +class B(var a: Int) { + var minus = false + var minusAssign = false + + operator fun minus(value: Int): B { + minus = true + return B(a + value) + } + +} + +fun box(){ + val b = B(1) + b -= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.exceptions.compiletime.txt new file mode 100644 index 00000000000..93cb6147cc4 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.exceptions.compiletime.txt @@ -0,0 +1,3 @@ +java.lang.IllegalStateException: ASSIGN_OPERATOR_AMBIGUITY: Assignment operators ambiguity: +public final operator fun times(value: Int): B defined in B +public final operator fun timesAssign(value: Int): Unit defined in B (31,7) in /7.1.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.kt new file mode 100644 index 00000000000..a2288865169 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.kt @@ -0,0 +1,32 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 7 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 8 + * NUMBER: 1 + * DESCRIPTION: A *= B is exactly the same as A.timesAssign(B) or A = A.times(B) (applied in order) + * EXCEPTION: compiletime + */ + +class B(var a: Int) { + var times = false + var timesAssign = false + + operator fun times(value: Int): B { + times = true + return B(a * value) + } + + operator fun timesAssign(value: Int) { + timesAssign = true + a = a * value + } +} + +fun box() { + var b = B(1) + b *= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.exceptions.compiletime.txt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.exceptions.compiletime.txt new file mode 100644 index 00000000000..7c49483fad3 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.exceptions.compiletime.txt @@ -0,0 +1 @@ +java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /7.2.kt diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.kt new file mode 100644 index 00000000000..b827bbb843e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.kt @@ -0,0 +1,31 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 7 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 8 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 9 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A *= B is exactly the same as A.timesAssign(B) or A = A.times(B) (applied in order) + * EXCEPTION: compiletime + */ + + +class B(var a: Int) { + var times = false + var timesAssign = false + + operator fun times(value: Int): B { + times = true + return B(a * value) + } + +} + +fun box() { + val b = B(1) + b *= 1 //error +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt new file mode 100644 index 00000000000..c1f278e6a64 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: A += B is exactly the same as A.plusAssign(B) or A = A.plus(B) (applied in order) + */ + +class B(var a: Int) { + var plus = false + var plusAssign = false + + operator fun plus(value: Int): B { + plus = true + return B(a + value) + } + + operator fun plusAssign(value: Int) { + plusAssign = true + a = a + value + } +} + +fun box(): String { + val b = B(1) + b += 1 + + if (!b.plus && b.plusAssign && b.a == 2) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.2.kt new file mode 100644 index 00000000000..d8245fffe55 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.2.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 2 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 3 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A += B is exactly the same as A.plusAssign(B) or A = A.plus(B) (applied in order) + */ + + +class B(var a: Int) { + var plus = false + + operator fun plus(value: Int): B { + plus = true + a= a + value + return this + } + +} + +fun box(): String { + var b = B(1) + b += 1 + + if (b.plus && b.a == 2) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.1.kt new file mode 100644 index 00000000000..ee3a8641a80 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.1.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 10 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 11 + * NUMBER: 1 + * DESCRIPTION: A /= B is exactly the same as A.divAssign(B) or A = A.div(B) (applied in order) + */ + +class B(var a: Int) { + var div = false + var divAssign = false + + operator fun div(value: Int): B { + div = true + return B(a / value) + } + + operator fun divAssign(value: Int) { + divAssign = true + a = a / value + } +} + +fun box(): String { + val b = B(1) + b /= 1 + + if (!b.div && b.divAssign) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.2.kt new file mode 100644 index 00000000000..8f065d49ed1 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.2.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 10 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 11 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 12 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A /= B is exactly the same as A.divAssign(B) or A = A.div(B) (applied in order) + */ + + +class B(var a: Int) { + var div = false + + operator fun div(value: Int): B { + div = true + a= a / value + return this + } + +} + +fun box(): String { + var b = B(1) + b /= 1 + + if (b.div) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.1.kt new file mode 100644 index 00000000000..80fd6a6e346 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.1.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 13 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 14 + * NUMBER: 1 + * DESCRIPTION: A %= B is exactly the same as A.remAssign(B) or A = A.rem(B) (applied in order) + */ + +class B(var a: Int) { + var rem = false + var remAssign = false + + operator fun rem(value: Int): B { + rem = true + return B(a % value) + } + + operator fun remAssign(value: Int) { + remAssign = true + a = a % value + } +} + +fun box(): String { + val b = B(1) + b %= 1 + + if (!b.rem && b.remAssign) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.2.kt new file mode 100644 index 00000000000..a531619ceff --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.2.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 13 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 14 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 15 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A %= B is exactly the same as A.remAssign(B) or A = A.rem(B) (applied in order) + */ + + +class B(var a: Int) { + var rem = false + + operator fun rem(value: Int): B { + rem = true + a= a % value + return this + } + +} + +fun box(): String { + var b = B(1) + b %= 1 + + if (b.rem) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.1.kt new file mode 100644 index 00000000000..57c2918d951 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.1.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 4 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 5 + * NUMBER: 1 + * DESCRIPTION: A -= B is exactly the same as A.minusAssign(B) or A = A.minus(B) (applied in order) + */ + +class B(var a: Int) { + var minus = false + var minusAssign = false + + operator fun minus(value: Int): B { + minus = true + return B(a - value) + } + + operator fun minusAssign(value: Int) { + minusAssign = true + a = a - value + } +} + +fun box(): String { + val b = B(1) + b -= 1 + + if (!b.minus && b.minusAssign && b.a == 0) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.2.kt new file mode 100644 index 00000000000..c91532955db --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.2.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 4 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 5 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A -= B is exactly the same as A.plusAssign(B) or A = A.minus(B) (applied in order) + */ + + +class B(var a: Int) { + var minus = false + + operator fun minus(value: Int): B { + minus = true + a= a - value + return this + } + +} + +fun box(): String { + var b = B(1) + b -= 1 + + if (b.minus && b.a == 0) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.1.kt new file mode 100644 index 00000000000..e1e9b46d7f2 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.1.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 7 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 8 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 9 + * NUMBER: 1 + * DESCRIPTION: A *= B is exactly the same as A.timesAssign(B) or A = A.times(B) (applied in order) + */ + +class B(var a: Int) { + var times = false + var timesAssign = false + + operator fun times(value: Int): B { + times = true + return B(a * value) + } + + operator fun timesAssign(value: Int) { + timesAssign = true + a = a * value + } +} + +fun box(): String { + val b = B(4) + b *= 3 + + if (!b.times && b.timesAssign && b.a == 12) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.2.kt new file mode 100644 index 00000000000..79c78ddbd45 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.2.kt @@ -0,0 +1,34 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 7 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 8 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 9 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: A *= B is exactly the same as A.timesAssign(B) or A = A.times(B) (applied in order) + */ + + +class B(var a: Int) { + var times = false + + operator fun times(value: Int): B { + times = true + a= a * value + return this + } + +} + +fun box(): String { + var b = B(2) + b *= 3 + + if (b.times && b.a == 6) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/testsMap.json new file mode 100644 index 00000000000..781a5961bb0 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/testsMap.json @@ -0,0 +1,308 @@ +{ + "2": { + "neg": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt", + "unexpectedBehaviour": false + } + ], + "10": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "11": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.kt", + "unexpectedBehaviour": false + } + ], + "13": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "14": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.kt", + "unexpectedBehaviour": false + } + ], + "7": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "8": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.kt", + "unexpectedBehaviour": false + } + ], + "4": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.minusAssign(B) or A \u003d A.minus(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.minusAssign(B) or A \u003d A.minus(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "5": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.minusAssign(B) or A \u003d A.minus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.minusAssign(B) or A \u003d A.minus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.kt", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A +\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.plus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt", + "unexpectedBehaviour": false + } + ], + "10": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "11": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A /\u003d B is exactly the same as A.divAssign(B) or A \u003d A.div(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.1.kt", + "unexpectedBehaviour": false + } + ], + "13": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "14": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A %\u003d B is exactly the same as A.remAssign(B) or A \u003d A.rem(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.2.kt", + "unexpectedBehaviour": false + } + ], + "7": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "8": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.2.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "A *\u003d B is exactly the same as A.timesAssign(B) or A \u003d A.times(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.1.kt", + "unexpectedBehaviour": false + } + ], + "4": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.minusAssign(B) or A \u003d A.minus(B) (applied in order)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.minus(B) (applied in order)", + "unexpectedBehaviour": false + } + ], + "5": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.minusAssign(B) or A \u003d A.minus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "A -\u003d B is exactly the same as A.plusAssign(B) or A \u003d A.minus(B) (applied in order)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.2.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.1.kt new file mode 100644 index 00000000000..4de201f95a7 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.1.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: If a property has a setter, it is called using the right-hand side expression as its argument; + */ + +var flag1 = false +var flag2 = false +val valToSet = 5 + +class C() { + var counter = 0 + set(value) { + flag1 = true + if (value == valToSet) + flag2 = true + field = value + } +} + +fun box(): String { + val c = C() + assert(!flag1) + assert(!flag2) + c.counter = valToSet + if (flag1 && flag2 && c.counter == valToSet) return "OK" + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.2.kt new file mode 100644 index 00000000000..e59b373940c --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.2.kt @@ -0,0 +1,33 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: If a property has a setter, it is called using the right-hand side expression as its argument; + */ + + +var flag1 = false +var flag2 = false +val valToSet = 5 + + +var counter = 0 + set(value) { + flag1 = true + if (value == valToSet) + flag2 = true + field = value + } + + +fun box(): String { + assert(!flag1) + assert(!flag2) + counter = valToSet + if (flag1 && flag2 && counter == valToSet) return "OK" + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.3.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.3.kt new file mode 100644 index 00000000000..3d82ab8d166 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.3.kt @@ -0,0 +1,40 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * NUMBER: 3 + * DESCRIPTION: If a property has a setter (including delegated properties), it is called using the right-hand side expression as its argument + */ + +import kotlin.reflect.KProperty + +var flag = false +var data = "FooBoo" + +fun box(): String { + val e = Example() + assert(!flag) + e.p = data + if (flag && e.p == data) return "OK" + return "NOK" +} + +class Example { + var p: String by Delegate() +} + + +class Delegate { + var d: String? = null + operator fun getValue(example: Example, property: KProperty<*>): String { + return d.toString() + } + operator fun setValue(example: Example, property: KProperty<*>, s: String) { + flag = true + d = s + } +} + diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.4.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.4.kt new file mode 100644 index 00000000000..8aeca3a2dfa --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.4.kt @@ -0,0 +1,35 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-300 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 4 + * DESCRIPTION: check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.) + */ + + +var flag1 = false +var flag2 = false +val valToSet = 5 + +class C() { + var counter = 0 + set(value) { + flag1 = true + if (value == valToSet) + flag2 = true + field = value + } +} + +fun box(): String { + val c : C? = C() + assert(!flag1) + assert(!flag2) + c?.counter = valToSet + if ( flag1 && flag2 && c?.counter == valToSet) return "OK" + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.5.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.5.kt new file mode 100644 index 00000000000..51e42c467ec --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.5.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-300 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 5 + * DESCRIPTION: check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.) + */ + +val valToSet = 5 + +class C() { + var counter = 0 +} + +fun box(): String { + val c :C?= C() + c?.counter = valToSet + if (c?.counter == valToSet) return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.6.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.6.kt new file mode 100644 index 00000000000..1fa2c033a47 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.6.kt @@ -0,0 +1,36 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-300 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 6 + * DESCRIPTION: check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.) + */ + + + +var flag1 = false +var flag2 = false +val valToSet = 5 + +class C() { + var counter = 0 + set(value) { + flag1 = true + if (value == valToSet) + flag2 = true + field = value + } +} + +fun box(): String { + val c : C? = null + assert(!flag1) + assert(!flag2) + c?.counter = valToSet + if ( !flag1 && !flag2 && c?.counter != valToSet) return "OK" + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.7.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.7.kt new file mode 100644 index 00000000000..e0168c19746 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.7.kt @@ -0,0 +1,42 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-300 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 7 + * DESCRIPTION: check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.) + */ + + +import kotlin.reflect.KProperty + +var flag = false +var data = "FooBoo" + +fun box(): String { + val e: Example? = Example() + assert(!flag) + e?.p = data + if (flag && e?.p == data) return "OK" + return "NOK" +} + +class Example { + var p: String by Delegate() +} + + +class Delegate { + var d: String? = null + operator fun getValue(example: Example, property: KProperty<*>): String { + return d.toString() + } + operator fun setValue(example: Example, property: KProperty<*>, s: String) { + flag = true + d = s + } +} + diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.8.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.8.kt new file mode 100644 index 00000000000..33411a56c73 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.8.kt @@ -0,0 +1,42 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-300 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 8 + * DESCRIPTION: check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.) + */ + + +import kotlin.reflect.KProperty + +var flag = false +var data = "FooBoo" + +fun box(): String { + val e: Example? = null + assert(!flag) + e?.p = data + if (!flag && e?.p != data) return "OK" + return "NOK" +} + +class Example { + var p: String by Delegate() +} + + +class Delegate { + var d: String? = null + operator fun getValue(example: Example, property: KProperty<*>): String { + return d.toString() + } + operator fun setValue(example: Example, property: KProperty<*>, s: String) { + flag = true + d = s + } +} + diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.1.kt new file mode 100644 index 00000000000..0d31377ebf9 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.1.kt @@ -0,0 +1,24 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: If a property has a setter, it is called using the right-hand side expression as its argument; + */ + + +val valToSet = 5 + +class C() { + var counter = 0 +} + +fun box(): String { + val c = C() + c.counter = valToSet + if (c.counter == valToSet) return "OK" + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.2.kt new file mode 100644 index 00000000000..098caedb976 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.2.kt @@ -0,0 +1,20 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: If a property has a setter, it is called using the right-hand side expression as its argument; + */ + +val valToSet = 5 + +var counter = 0 + +fun box(): String { + counter = valToSet + if (counter == valToSet) return "OK" + return "NOK" +} diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.3.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.3.kt new file mode 100644 index 00000000000..9e1044420a6 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.3.kt @@ -0,0 +1,37 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, simple-assignments -> paragraph 2 -> sentence 2 + * NUMBER: 3 + * DESCRIPTION: If a property has a setter (including delegated properties), it is called using the right-hand side expression as its argument + */ + +import kotlin.reflect.KProperty + +var data = "FooBoo" + +fun box(): String { + val e = Example() + e.p = data + if ( e.p == data) return "OK" + return "NOK" +} + +class Example { + var p: String by Delegate() +} + + +class Delegate { + var d: String? = null + operator fun getValue(example: Example, property: KProperty<*>): String { + return d.toString() + } + operator fun setValue(example: Example, property: KProperty<*>, s: String) { + d = s + } +} + diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6/pos/1.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6/pos/1.1.kt new file mode 100644 index 00000000000..4c830a5e3a9 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6/pos/1.1.kt @@ -0,0 +1,38 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments, simple-assignments -> paragraph 6 -> sentence 1 + * RELEVANT PLACES: statements, assignments, simple-assignments -> paragraph 7 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: + */ + + +class A() { + val list = arrayListOf(1, 2, 3) + operator fun set(a: Int, value: Int) { + this.list.add(a, value) + } + + operator fun set(a: Int, b: Int, value: Int) { + this.list.add(a, value) + this.list.add(b, value) + } +} + +fun box(): String { + val a = A() + a[0] = 0 + + val b = A() + b[0, 2] = 0 + + if (a.list == arrayListOf(0, 1, 2, 3) && + b.list == arrayListOf(0, 1, 0, 2, 3) + ) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/testsMap.json new file mode 100644 index 00000000000..002e07258b4 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/testsMap.json @@ -0,0 +1,136 @@ +{ + "6": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "unexpectedBehaviour": false + } + ] + } + }, + "7": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "pos": { + "1": [ + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If a property has a setter, it is called using the right-hand side expression as its argument;", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If a property has a setter (including delegated properties), it is called using the right-hand side expression as its argument", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If a property has a setter, it is called using the right-hand side expression as its argument;", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.6.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If a property has a setter, it is called using the right-hand side expression as its argument;", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.7.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.8.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.4.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If a property has a setter (including delegated properties), it is called using the right-hand side expression as its argument", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-300", + "casesNumber": 0, + "description": "check if a property has a setter, it is called using the right-hand side expression as its argument;If the left-hand side of an assignment refers to a mutable property through the usage of safe navigation operator (?.)", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.5.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 0, + "description": "If a property has a setter, it is called using the right-hand side expression as its argument;", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.1.kt new file mode 100644 index 00000000000..65c5e98a90e --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.1.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 3 + * RELEVANT PLACES: statements, loop-statements, do-while-loop-statement -> paragraph 2 -> sentence 1 + * statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: do-while-loop-statement evaluates the loop condition expression after evaluating the loop body. + */ + + +fun box(): String { + var x = 1; + do { + x++ + } while (false) + if (x == 2) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.2.kt new file mode 100644 index 00000000000..63de09e5f5d --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.2.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 3 + * RELEVANT PLACES: statements, loop-statements, do-while-loop-statement -> paragraph 2 -> sentence 1 + * statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: do-while-loop-statement evaluates the loop condition expression after evaluating the loop body. + */ + + +fun box(): String { + var x = 1; + do { + x++ + } while (x < 2) + if (x == 2) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/testsMap.json new file mode 100644 index 00000000000..0f92ff7a744 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/testsMap.json @@ -0,0 +1,40 @@ +{ + "1": { + "pos": { + "3": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "pos": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "do-while-loop-statement evaluates the loop condition expression after evaluating the loop body.", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.2.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.1.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.1.kt new file mode 100644 index 00000000000..c5e3ba9fbd4 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.1.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: statements, loop-statements, while-loop-statement -> paragraph 2 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: while-loop-statement evaluates the loop condition expression before evaluating the loop body. + */ + +fun box(): String { + var x = 1; + var cond = true + while (cond) { + x++ + if (x == 5) cond = false + } + if (x == 5) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.2.kt b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.2.kt new file mode 100644 index 00000000000..02c7aae4f69 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.2.kt @@ -0,0 +1,23 @@ +// WITH_RUNTIME + +/* + * KOTLIN CODEGEN BOX SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: statements, loop-statements, while-loop-statement -> paragraph 2 -> sentence 1 + * NUMBER: 2 + * DESCRIPTION: while-loop-statement evaluates the loop condition expression before evaluating the loop body. + */ + +fun box(): String { + var x = 1; + var cond = true + while (cond) { + x++ + cond = false + } + if (x == 2) + return "OK" + return "NOK" +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/testsMap.json b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/testsMap.json new file mode 100644 index 00000000000..41631775fa0 --- /dev/null +++ b/compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/testsMap.json @@ -0,0 +1,40 @@ +{ + "1": { + "pos": { + "2": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "pos": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-253", + "casesNumber": 0, + "description": "while-loop-statement evaluates the loop condition expression before evaluating the loop body.", + "path": "compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.2.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.kt index 250f5f59385..1d58ef91933 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/additive-expression/p-4/pos/1.1.kt @@ -8,6 +8,7 @@ * SPEC VERSION: 0.1-218 * PLACE: expressions, additive-expression -> paragraph 4 -> sentence 1 * RELEVANT PLACES: expressions, additive-expression -> paragraph 4 -> sentence 2 + * overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: The return type of these functions is not restricted. * HELPERS: checkType 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 index f340b1aeb2b..5d21107a9a3 100644 --- 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 @@ -1,24 +1,4 @@ { - "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": [ @@ -31,5 +11,18 @@ } ] } + }, + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "Bare type", + "path": "compiler/testData/diagnostics/tests/callableReference/bareType.kt", + "unexpectedBehaviour": false + } + ] + } } } \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/call-and-property-access-expressions/navigation-operators/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/call-and-property-access-expressions/navigation-operators/testsMap.json new file mode 100644 index 00000000000..e183128aab6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/call-and-property-access-expressions/navigation-operators/testsMap.json @@ -0,0 +1,28 @@ +{ + "9": { + "pos": { + "2": [ + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "Correct info after array like call", + "path": "compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "8": { + "pos": { + "1": [ + { + "specVersion": "0.1-220", + "casesNumber": 0, + "description": "Correct info after array like call", + "path": "compiler/testData/diagnostics/tests/callableReference/correctInfoAfterArrayLikeCall.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt index fba4c9dd6c9..e110fe9d30e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt @@ -7,6 +7,7 @@ * * SPEC VERSION: 0.1-220 * PLACE: expressions, comparison-expressions -> paragraph 1 -> sentence 2 + * RELEVANT PLACES: overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: <, >, <= and >= operators are overloadable */ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.kt index 83e80cd8d14..14a6c24aa4e 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.kt @@ -7,6 +7,7 @@ * * SPEC VERSION: 0.1-218 * PLACE: expressions, comparison-expressions -> paragraph 4 -> sentence 1 + * RELEVANT PLACES: overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: The compareTo operator function must have return type kotlin.Int */ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-5/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-5/pos/1.1.kt index a60d71c2793..2a30f6cd427 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-5/pos/1.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-5/pos/1.1.kt @@ -7,6 +7,7 @@ * * SPEC VERSION: 0.1-218 * PLACE: expressions, comparison-expressions -> paragraph 5 -> sentence 1 + * RELEVANT PLACES: overloadable-operators -> paragraph 4 -> sentence 1 * NUMBER: 1 * DESCRIPTION: All comparison expressions always have type kotlin.Boolean. * HELPERS: checkType diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.kt new file mode 100644 index 00000000000..9dd9551515f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.kt @@ -0,0 +1,38 @@ +// !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-222 + * PLACE: expressions, jump-expressions, break-expression -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A break expression is a jump expression allowed only within loop bodies. + */ + + +// TESTCASE NUMBER: 1 +fun case1() { + val inputList = listOf(1, 2, 3) + inputList.forEach { + listOf("1.", "2.", "3.").forEach { + if (true) break@forEach + } + } +} + +// TESTCASE NUMBER: 2 +fun case2() { + val inputList = listOf(1, 2, 3) + inputList.forEach { + listOf("1.", "2.", "3.").forEach { + if (true) break + } + } +} + +// TESTCASE NUMBER: 3 +fun case3() { + break +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/testsMap.json new file mode 100644 index 00000000000..480e2a16ce1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/testsMap.json @@ -0,0 +1,14 @@ +{ + "1": { + "neg": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 3, + "description": "A break expression is a jump expression allowed only within loop bodies.", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.kt new file mode 100644 index 00000000000..bcc1e1739d5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.kt @@ -0,0 +1,38 @@ +// !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-222 + * PLACE: expressions, jump-expressions, continue-expression -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: A continue expression is a jump expression allowed only within loop bodies. + */ + + +// TESTCASE NUMBER: 1 +fun case1() { + val inputList = listOf(1, 2, 3) + inputList.forEach { + listOf("1.", "2.", "3.").forEach { + if (true) continue@forEach + } + } +} + +// TESTCASE NUMBER: 2 +fun case2() { + val inputList = listOf(1, 2, 3) + inputList.forEach { + listOf("1.", "2.", "3.").forEach { + if (true) continue + } + } +} + +// TESTCASE NUMBER: 3 +fun case3() { + continue +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/testsMap.json new file mode 100644 index 00000000000..af88e758aa3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/testsMap.json @@ -0,0 +1,14 @@ +{ + "1": { + "neg": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 3, + "description": "A continue expression is a jump expression allowed only within loop bodies.", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt new file mode 100644 index 00000000000..09d7e16c26c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt @@ -0,0 +1,63 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: expressions, jump-expressions, return-expressions -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: + * HELPERS: checkType + */ + +// TESTCASE NUMBER: 1 +fun case1() { + val x = fooCase1() + x checkType { check() } +} + +class Case1 + +fun fooCase1(): Case1 = TODO() + +// TESTCASE NUMBER: 2 +fun case2() { + val x = fooCase2() + x checkType { check() } +} + +fun fooCase2(): Case1 { + val x = "" + return Case1() + val y = "" +} + +// TESTCASE NUMBER: 3 +fun case3() { + val x = object : Case13 { + override fun fooCase3(): Int { + return 1 + "str" + 3 + } + }.fooCase3() + + x checkType { check() } + +} + +interface Case13 { + fun fooCase3(): Int +} + +// TESTCASE NUMBER: 4 +fun case4() { + val x = fooCase4() + x checkType { check() } +} + +fun fooCase4() { + return +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/testsMap.json index 880351f4918..14b3f35b354 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/testsMap.json @@ -1,4 +1,16 @@ { + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 4, + "description": "", + "unexpectedBehaviour": false + } + ] + } + }, "5": { "neg": { "2": [ diff --git a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/neg/10.1.kt b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/neg/10.1.kt index 47e5dcd643d..1fd29bec554 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/neg/10.1.kt +++ b/compiler/tests-spec/testData/diagnostics/linked/expressions/when-expression/exhaustive-when-expressions/p-2/neg/10.1.kt @@ -10,6 +10,7 @@ * DESCRIPTION: Non-exhaustive when using nullable boolean values. */ + // TESTCASE NUMBER: 1 fun case_1(value_1: Boolean?): String = when(value_1) { true -> "" diff --git a/compiler/tests-spec/testData/diagnostics/linked/overloadable-operators/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/overloadable-operators/testsMap.json new file mode 100644 index 00000000000..22c219665ec --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/overloadable-operators/testsMap.json @@ -0,0 +1,33 @@ +{ + "4": { + "neg": { + "1": [ + { + "specVersion": "0.1-220", + "casesNumber": 1, + "description": "\u003c, \u003e, \u003c\u003d and \u003e\u003d operators are overloadable", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-1/neg/2.1.kt", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-218", + "casesNumber": 4, + "description": "The compareTo operator function must have return type kotlin.Int", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-4/neg/1.1.kt", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-218", + "casesNumber": 4, + "description": "All comparison expressions always have type kotlin.Boolean.", + "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/comparison-expressions/p-5/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt new file mode 100644 index 00000000000..810e072686b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt @@ -0,0 +1,32 @@ +// !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-253 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 2 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 3 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: An operator assignment A+=B + */ + + +class B(var a: Int) { + operator fun plus(value: Int): B { + a= a + value + return this + } + operator fun plusAssign(value: Int): Unit { + a= a + value + } +} + +// TESTCASE NUMBER: 1 +fun case1() { + var b = B(1) + b += 1 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt new file mode 100644 index 00000000000..4f1762cfe4c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt @@ -0,0 +1,32 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, assignments, operator-assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments, operator-assignments -> paragraph 2 -> sentence 2 + * statements, assignments, operator-assignments -> paragraph 2 -> sentence 3 + * statements, assignments, operator-assignments -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: An operator assignment A+=B + */ + + +class B(var a: Int) { + operator fun plus(value: Int): B { + a= a + value + return this + } + operator fun plusAssign(value: Int): Unit { + a= a + value + } +} + +// TESTCASE NUMBER: 1 +fun case1() { + val b = B(1) + b += 1 +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/testsMap.json new file mode 100644 index 00000000000..06f895f1ed3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/testsMap.json @@ -0,0 +1,42 @@ +{ + "2": { + "neg": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 1, + "description": "An operator assignment A+\u003dB", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-253", + "casesNumber": 1, + "description": "An operator assignment A+\u003dB", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt", + "unexpectedBehaviour": false + } + ] + }, + "pos": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 1, + "description": "An operator assignment A+\u003dB", + "unexpectedBehaviour": false + } + ], + "2": [ + { + "specVersion": "0.1-253", + "casesNumber": 1, + "description": "An operator assignment A+\u003dB", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.kt new file mode 100644 index 00000000000..f90abccc572 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.kt @@ -0,0 +1,69 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Both left-hand and right-hand sides of an assignment must be expressions + */ + + +/* + * TESTCASE NUMBER: 1 + * NOTE: right-hand side of an assignment must be expression + */ +fun case1() { + val x = for () { } + val y = for (x in 1..2) { } + + val a = while () { } + val b = while (false) { } + val c = while () ; +} + +/* + * TESTCASE NUMBER: 2 + * NOTE: right-hand side of an assignment must be expression + */ +fun case2() { + var x = for () { } + var y = for (x in 1..2) { } + + var a = while () { } + var b = while (false) { } + var c = while () ; +} + +/* + * TESTCASE NUMBER: 3 + * NOTE: right-hand side of an assignment must be expression + */ +fun case3() { + var x :Any? + var y :Any? + + var a :Any? + var b :Any? + var c :Any? + + x = for () { } + y = for (x in 1..2) { } + + a = while () { } + b = while (false) { } + c = while () ; +} + +/* + * TESTCASE NUMBER: 4 + * NOTE: left-hand side of an assignment must be expression + */ +fun case4() { + for (x in 1..2) {} = TODO(); + + while (false) { } = TODO() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.kt new file mode 100644 index 00000000000..e9266f147aa --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.kt @@ -0,0 +1,41 @@ +// !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-222 + * PLACE: statements, assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments -> paragraph 3 -> sentence 1 + * statements, assignments, simple-assignments -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: Check the expression is not assignable if an identifier referring to an unmutable property + */ + +/* + * TESTCASE NUMBER: 1 + * NOTE: an identifier referring to a unmutable property + */ +fun case1() { + val x : Any + x = "0" + x = 1 + x = 2.0 + + val y : Any = 0 + y = "0" + y = 1.0 +} + +/* + * TESTCASE NUMBER: 2 + * NOTE: an identifier referring to a unmutable property + */ +fun case2() { + val x : Any + mutableListOf(0).forEach({ x = it }) + + val y : Any = 1 + mutableListOf(1).forEach({ y = it }) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.kt new file mode 100644 index 00000000000..b6c1dc12594 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.kt @@ -0,0 +1,59 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNSAFE_CALL -UNREACHABLE_CODE -UNUSED_VARIABLE -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE -UNUSED_PARAMETER -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (NEGATIVE) + * + * SPEC VERSION: 0.1-222 + * PLACE: statements, assignments -> paragraph 2 -> sentence 1 + * RELEVANT PLACES: statements, assignments -> paragraph 3 -> sentence 2 + * statements, assignments, simple-assignments -> paragraph 1 -> sentence 2 + * NUMBER: 2 + * DESCRIPTION: Check the expression is not assignable if a navigation expression referring to an unmutable property + */ + + +/* + * TESTCASE NUMBER: 1 + * NOTE: a navigation expression referring to a unmutable property + */ +fun case1() { + val x : Case1? = Case1() + x.x = "0" + x?.x = "0" + x::x = TODO() +} + +class Case1{ + val x : Any? + get() { TODO() } +} + +/* + * TESTCASE NUMBER: 2 + * NOTE: an identifier referring to a ununmutable property + */ +fun case2() { + val x : Case2? = Case2(null) + x.x = "0" + x?.x = "0" + x::x = TODO() +} + +class Case2(val x: Any?) {} + +/* + * TESTCASE NUMBER: 3 + * NOTE: an identifier referring to a ununmutable property + */ +fun case3() { + val x : Case3? = Case3() + x.x = "0" + x?.x = "0" + x::x = TODO() +} + +class Case3() { + val x: Any? = null +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/simple-assignments/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/simple-assignments/testsMap.json new file mode 100644 index 00000000000..307a6c7a10e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/simple-assignments/testsMap.json @@ -0,0 +1,15 @@ +{ + "1": { + "neg": { + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 4, + "description": "Both left-hand and right-hand sides of an assignment must be expressions", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.kt", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/testsMap.json index ab43402c363..b5b3cd0d9d2 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/testsMap.json +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/assignments/testsMap.json @@ -1,7 +1,44 @@ { + "1": { + "neg": { + "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 4, + "description": "Both left-hand and right-hand sides of an assignment must be expressions", + "unexpectedBehaviour": false + } + ] + } + }, + "2": { + "neg": { + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 3, + "description": "Check the expression is not assignable if a navigation expression referring to an unmutable property", + "unexpectedBehaviour": false + }, + { + "specVersion": "0.1-222", + "casesNumber": 2, + "description": "Check the expression is not assignable if an identifier referring to an unmutable property", + "unexpectedBehaviour": false + } + ] + } + }, "3": { "neg": { "2": [ + { + "specVersion": "0.1-222", + "casesNumber": 3, + "description": "Check the expression is not assignable if a navigation expression referring to an unmutable property", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.kt", + "unexpectedBehaviour": false + }, { "specVersion": "0.1-213", "casesNumber": 2, @@ -16,6 +53,15 @@ "path": "compiler/tests-spec/testData/diagnostics/linked/expressions/prefix-expressions/prefix-decrement-expression/p-4/neg/1.1.kt", "unexpectedBehaviour": false } + ], + "1": [ + { + "specVersion": "0.1-222", + "casesNumber": 2, + "description": "Check the expression is not assignable if an identifier referring to an unmutable property", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.1.kt", + "unexpectedBehaviour": false + } ] } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/1.1.kt new file mode 100644 index 00000000000..c439ff51329 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/1.1.kt @@ -0,0 +1,33 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNREACHABLE_CODE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 1 + * RELEVANT PLACES: statements, loop-statements, do-while-loop-statement -> paragraph 3 -> sentence 1 + * statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 2 + * NUMBER: 1 + * DESCRIPTION: do-while-loop statement body contains zero statements + */ + +// TESTCASE NUMBER: 1 +fun case1() { + do { + } while (true) +} + +// TESTCASE NUMBER: 2 +fun case2() { + do { + } while (false) +} + +// TESTCASE NUMBER: 3 +fun case3() { + do { + } while (TODO()) +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.kt new file mode 100644 index 00000000000..6692374bfb4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.kt @@ -0,0 +1,34 @@ +// !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-253 + * PLACE: statements, loop-statements, do-while-loop-statement -> paragraph 3 -> sentence 1 + * RELEVANT PLACES: statements, loop-statements, do-while-loop-statement -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: condition expression is not a subtype of kotlin.Boolean. + */ + +// TESTCASE NUMBER: 1 +fun case1() { + do { + } while ("boo") +} + +// TESTCASE NUMBER: 2 +fun case2() { + val condition: Any = true + do { + } while (condition) +} + +// TESTCASE NUMBER: 3 +fun case3() { + val condition: Boolean? = true + do { + } while (condition) +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/testsMap.json new file mode 100644 index 00000000000..0c038a411f7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/testsMap.json @@ -0,0 +1,48 @@ +{ + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 3, + "description": "do-while-loop statement body contains zero statements", + "unexpectedBehaviour": false + } + ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 3, + "description": "condition expression is not a subtype of kotlin.Boolean.", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 3, + "description": "do-while-loop statement body contains zero statements", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 3, + "description": "condition expression is not a subtype of kotlin.Boolean.", + "unexpectedBehaviour": false + } + ] + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1/pos/1.1.kt new file mode 100644 index 00000000000..fa5534509c8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1/pos/1.1.kt @@ -0,0 +1,32 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNREACHABLE_CODE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * + * SPEC VERSION: 0.1-253 + * PLACE: statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 1 + * RELEVANT PLACES: statements, loop-statements, while-loop-statement -> paragraph 3 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: while-loop statement body contains zero statements + */ + +// TESTCASE NUMBER: 1 +fun case1() { + while (true) { + } +} + +// TESTCASE NUMBER: 2 +fun case2() { + while (false) { + } +} + +// TESTCASE NUMBER: 3 +fun case3() { + while (TODO()) { + } +} + diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.kt new file mode 100644 index 00000000000..eaf401084d9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.kt @@ -0,0 +1,29 @@ +// !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-253 + * PLACE: statements, loop-statements, while-loop-statement -> paragraph 3 -> sentence 1 + * RELEVANT PLACES: statements, loop-statements, while-loop-statement -> paragraph 1 -> sentence 1 + * NUMBER: 1 + * DESCRIPTION: condition expression is not a subtype of kotlin.Boolean. + * HELPERS: checkType + */ + +// FILE: KotlinClass.kt +// TESTCASE NUMBER: 1 +fun case1() { + val condition: Any = true + while (condition && "true") { + } +} + +// TESTCASE NUMBER: 2 +fun case2() { + val condition: Boolean? = true + while (condition) { + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/testsMap.json b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/testsMap.json new file mode 100644 index 00000000000..762cafc8ada --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/testsMap.json @@ -0,0 +1,48 @@ +{ + "1": { + "pos": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 3, + "description": "while-loop statement body contains zero statements", + "unexpectedBehaviour": false + } + ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 2, + "description": "condition expression is not a subtype of kotlin.Boolean.", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.kt", + "unexpectedBehaviour": false + } + ] + } + }, + "3": { + "pos": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 3, + "description": "while-loop statement body contains zero statements", + "path": "compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1/pos/1.1.kt", + "unexpectedBehaviour": false + } + ] + }, + "neg": { + "1": [ + { + "specVersion": "0.1-253", + "casesNumber": 2, + "description": "condition expression is not a subtype of kotlin.Boolean.", + "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 a7d6ba9a6c4..f0dc77c1da0 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", "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"); + 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/assignments/simple-assignments", "linked/inheritance", "linked/expressions/function-literals", "linked/expressions/call-and-property-access-expressions", "linked/overloadable-operators", "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, "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"); + 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/assignments/simple-assignments", "inheritance", "expressions/function-literals", "expressions/call-and-property-access-expressions", "overloadable-operators", "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") @@ -1779,6 +1779,94 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Break_expression extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBreak_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/break-expression/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Continue_expression extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInContinue_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/continue-expression/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/p-2") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -1822,6 +1910,37 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/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/jump-expressions/return-expressions/p-1/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/expressions/jump-expressions/return-expressions/p-5") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -3252,6 +3371,324 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } + @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, "assignments/simple-assignments"); + } + + @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, "simple-assignments"); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Operator_assignments extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInOperator_assignments() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_2 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/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/statements/assignments/operator-assignments/p-2/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/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/statements/assignments/operator-assignments/p-2/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/operator-assignments/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg/2.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-1/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_2 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/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/statements/assignments/p-2/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg/1.2.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/assignments/p-2/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Loop_statements extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInLoop_statements() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Do_while_loop_statement extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDo_while_loop_statement() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1/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/statements/loop-statements/do-while-loop-statement/p-1/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/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.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/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("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/do-while-loop-statement/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class While_loop_statement extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInWhile_loop_statement() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1/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/statements/loop-statements/while-loop-statement/p-1/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/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.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/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("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg/1.1.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/statements/loop-statements/while-loop-statement/p-3/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-system") @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 9e825841e0f..43b4f248c38 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", "linked/statements"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box"), Pattern.compile("^(.+)\\.kt$"), null, true, "helpers", "templates"); } @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, "statements"); + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked"), Pattern.compile("^(.+)\\.kt$"), null, true); } @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions") @@ -1448,6 +1448,227 @@ public class BlackBoxCodegenTestSpecGenerated extends AbstractBlackBoxCodegenTes } } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Jump_expressions extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInJump_expressions() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Break_expression extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInBreak_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/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/jump-expressions/break-expression/p-3/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/1.2.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos/2.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/break-expression/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Continue_expression extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInContinue_expression() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/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/jump-expressions/continue-expression/p-3/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/1.2.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos/2.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/continue-expression/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Return_expressions extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInReturn_expressions() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos/1.3.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_3 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_3() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/2.1.kt"); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos/3.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/expressions/jump-expressions/return-expressions/p-3/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/expressions/logical-conjunction-expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -3072,6 +3293,420 @@ 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/statements/assignments/operator-assignments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Operator_assignments extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInOperator_assignments() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_2 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("10.1.kt") + public void test10_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.1.kt"); + } + + @TestMetadata("10.2.kt") + public void test10_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/10.2.kt"); + } + + @TestMetadata("13.1.kt") + public void test13_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.1.kt"); + } + + @TestMetadata("13.2.kt") + public void test13_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/13.2.kt"); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/1.2.kt"); + } + + @TestMetadata("4.1.kt") + public void test4_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.1.kt"); + } + + @TestMetadata("4.2.kt") + public void test4_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/4.2.kt"); + } + + @TestMetadata("7.1.kt") + public void test7_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.1.kt"); + } + + @TestMetadata("7.2.kt") + public void test7_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg/7.2.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/neg"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/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("10.1.kt") + public void test10_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.1.kt"); + } + + @TestMetadata("10.2.kt") + public void test10_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/10.2.kt"); + } + + @TestMetadata("13.1.kt") + public void test13_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.1.kt"); + } + + @TestMetadata("13.2.kt") + public void test13_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/13.2.kt"); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/1.2.kt"); + } + + @TestMetadata("4.1.kt") + public void test4_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.1.kt"); + } + + @TestMetadata("4.2.kt") + public void test4_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/4.2.kt"); + } + + @TestMetadata("7.1.kt") + public void test7_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.1.kt"); + } + + @TestMetadata("7.2.kt") + public void test7_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos/7.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/operator-assignments/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Simple_assignments extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInSimple_assignments() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_2 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_2() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/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/statements/assignments/simple-assignments/p-2/pos/1.1.kt"); + } + + @TestMetadata("1.2.kt") + public void test1_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.2.kt"); + } + + @TestMetadata("1.3.kt") + public void test1_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.3.kt"); + } + + @TestMetadata("1.4.kt") + public void test1_4() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.4.kt"); + } + + @TestMetadata("1.5.kt") + public void test1_5() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.5.kt"); + } + + @TestMetadata("1.6.kt") + public void test1_6() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.6.kt"); + } + + @TestMetadata("1.7.kt") + public void test1_7() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.7.kt"); + } + + @TestMetadata("1.8.kt") + public void test1_8() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/1.8.kt"); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.2.kt"); + } + + @TestMetadata("2.3.kt") + public void test2_3() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos/2.3.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-2/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_6 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_6() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("1.1.kt") + public void test1_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6/pos/1.1.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/assignments/simple-assignments/p-6/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Loop_statements extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInLoop_statements() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Do_while_loop_statement extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInDo_while_loop_statement() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("3.1.kt") + public void test3_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.1.kt"); + } + + @TestMetadata("3.2.kt") + public void test3_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos/3.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/do-while-loop-statement/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class While_loop_statement extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInWhile_loop_statement() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class P_1 extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + public void testAllFilesPresentInP_1() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractBlackBoxCodegenTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, this, testDataFilePath); + } + + @TestMetadata("2.1.kt") + public void test2_1() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.1.kt"); + } + + @TestMetadata("2.2.kt") + public void test2_2() throws Exception { + runTest("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos/2.2.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadataWithExcluded(this.getClass(), new File("compiler/tests-spec/testData/codegen/box/linked/statements/loop-statements/while-loop-statement/p-1/pos"), Pattern.compile("^(.+)\\.kt$"), null, true); + } + } + } + } + } + } + @TestMetadata("compiler/tests-spec/testData/codegen/box/linked/type-system") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)