[Spec tests] Add tests for expressions and statements
This commit is contained in:
committed by
Victor Petukhov
parent
5f4a94a1b3
commit
5986ffae1e
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
+27
@@ -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"
|
||||
}
|
||||
+31
@@ -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"
|
||||
}
|
||||
+27
@@ -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"
|
||||
}
|
||||
+31
@@ -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"
|
||||
}
|
||||
+68
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+27
@@ -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"
|
||||
}
|
||||
+30
@@ -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"
|
||||
}
|
||||
+27
@@ -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"
|
||||
}
|
||||
+31
@@ -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"
|
||||
}
|
||||
+68
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
+28
@@ -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()
|
||||
}
|
||||
+32
@@ -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()
|
||||
}
|
||||
+26
@@ -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 = ""
|
||||
}
|
||||
+27
@@ -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"
|
||||
}
|
||||
+30
@@ -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"
|
||||
|
||||
}
|
||||
|
||||
|
||||
+95
@@ -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
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
}
|
||||
compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/1.1.kt
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/2.1.kt
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
compiler/tests-spec/testData/codegen/box/linked/expressions/multiplicative-expression/p-2/pos/3.1.kt
Vendored
+1
@@ -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)
|
||||
*/
|
||||
|
||||
Reference in New Issue
Block a user