New J2K: fix existing test data

This commit is contained in:
Ilya Kirillov
2019-04-22 15:11:42 +03:00
parent 101ae75b8c
commit d2a3d00548
28 changed files with 119 additions and 154 deletions
+11 -32
View File
@@ -1,18 +1,8 @@
// ERROR: 'return' is not allowed here
// ERROR: Type mismatch: inferred type is String but Unit was expected
// ERROR: 'return' is not allowed here
// ERROR: Type mismatch: inferred type is String but Unit was expected
// ERROR: 'return' is not allowed here
// ERROR: Type mismatch: inferred type is String but Unit was expected
class Java8Class {
fun foo0(r: Function0<String>) {}
fun foo1(r: Function1<Int, String?>) {}
fun foo2(r: Function2<Int, Int, String>) {}
fun helper() {}
fun foo() {
foo0 { "42" }
foo0 { "42" }
@@ -20,62 +10,51 @@ class Java8Class {
helper()
"42"
}
foo1 { i -> "42" }
foo1 { i -> "42" }
foo1 { i: Int -> "42" }
foo1 { i: Int -> "42" }
foo1 { i: Int ->
helper()
if (i > 1) {
return@foo1 "42"
return@foo1 null
}
"43"
}
foo2 { i, j -> "42" }
foo2 { i: Int, j: Int -> "42" }
foo2 { i: Int, j: Int ->
helper()
"42"
}
val f = { i: Int, k: Int ->
val f = label@{ i: Int, k: Int ->
helper()
if (i > 1) {
return "42"
return@label "42"
}
"43"
}
val f1 = { i1: Int, k1: Int ->
val f2 = { i2: Int, k2: Int ->
val f1 = label@{ i1: Int, k1: Int ->
val f2 = label@{ i2: Int, k2: Int ->
helper()
if (i2 > 1) {
return "42"
return@label "42"
}
"43"
}
if (i1 > 1) {
return f.invoke(i1, k1)
return@label f.invoke(i1, k1)
}
f.invoke(i1, k1)
}
val runnable = { }
val runnable = Runnable {}
foo1 { i: Int ->
if (i > 1) {
return@foo1 "42"
}
foo0 {
if (true) {
return@foo0 "42"
}
"43"
}
"43"
}
}