[Spec tests] Add tests for expressions and statements

This commit is contained in:
anastasiia.spaseeva
2020-01-10 17:00:43 +03:00
committed by Victor Petukhov
parent 5f4a94a1b3
commit 5986ffae1e
108 changed files with 4221 additions and 26 deletions
@@ -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)
*/
@@ -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)
*/
@@ -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)
*/
@@ -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)
*/
@@ -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)
*/
@@ -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)
*/
@@ -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<Any>()
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"
}
@@ -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<Any>()
while (x < 3) {
while (y< 3) {
y++
if (true) break
}
list1.add(x++)
}
if (list1.containsAll(inputList))
return "OK"
else return "NOK"
}
@@ -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<Any>()
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"
}
@@ -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<Any>()
while (x < 3) {
label@ while (y< 3) {
y++
if (true) break@label
}
list1.add(x++)
}
if (list1.containsAll(inputList))
return "OK"
else return "NOK"
}
@@ -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
}
]
}
}
}
@@ -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<Any>()
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"
}
@@ -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<Any>()
while (x < 3) {
while (y< 3) {
y++
if (true) continue
}
list1.add(x++)
}
if (list1.containsAll(inputList))
return "OK"
else return "NOK"
}
@@ -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<Any>()
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"
}
@@ -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<Any>()
while (x < 3) {
label@ while (y< 3) {
y++
if (true) continue@label
}
list1.add(x++)
}
if (list1.containsAll(inputList))
return "OK"
else return "NOK"
}
@@ -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
}
]
}
}
}
@@ -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()
}
@@ -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()
}
@@ -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 = ""
}
@@ -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<Any>()
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"
}
@@ -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<Any>()
inputList.forEach {
list1.add(it)
listOf("1.", "2.", "3.").forEach {
if (true) return@forEach
}
}
if (list1.containsAll(inputList))
return "OK"
else return "NOK"
}
@@ -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
}
]
}
}
}
@@ -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)
*/
@@ -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)
*/
@@ -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)
*/
@@ -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
@@ -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
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /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
}
@@ -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
@@ -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
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /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
}
@@ -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
@@ -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
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /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
}
@@ -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
@@ -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
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /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
}
@@ -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
@@ -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
}
@@ -0,0 +1 @@
java.lang.IllegalStateException: VAL_REASSIGNMENT: Val cannot be reassigned (30,5) in /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
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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
}
]
}
}
}
@@ -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"
}
@@ -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"
}
@@ -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
}
}
@@ -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"
}
@@ -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"
}
@@ -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"
}
@@ -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
}
}
@@ -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
}
}
@@ -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"
}
@@ -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"
}
@@ -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
}
}
@@ -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"
}
@@ -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
}
]
}
}
}
@@ -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"
}
@@ -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"
}
@@ -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
}
]
}
}
}
@@ -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"
}
@@ -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"
}
@@ -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
}
]
}
}
}