GreatSyntacticShift: Codegen testdata fixed
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import java.util.*
|
||||
|
||||
fun <T> ArrayList<T>.findAll(predicate: fun (T) : Boolean): ArrayList<T> {
|
||||
fun <T> ArrayList<T>.findAll(predicate: (T) -> Boolean): ArrayList<T> {
|
||||
val result = ArrayList<T>()
|
||||
for(val t in this) {
|
||||
if (predicate(t)) result.add(t)
|
||||
@@ -16,6 +16,6 @@ fun box(): String {
|
||||
list.add("Moscow")
|
||||
list.add("Munich")
|
||||
|
||||
val m: ArrayList<String> = list.findAll<String>({(name: String) => name.startsWith("M")})
|
||||
val m: ArrayList<String> = list.findAll<String>({(name: String) -> name.startsWith("M")})
|
||||
return if (m.size() == 2) "OK" else "fail"
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@ fun <T> T.mustBe(t : T) {
|
||||
assert("$this must be $t") {this == t}
|
||||
}
|
||||
|
||||
inline fun assert(message : String, condition : fun() : Boolean) {
|
||||
inline fun assert(message : String, condition : () -> Boolean) {
|
||||
if (!condition())
|
||||
throw AssertionError(message)
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@ class Request(val path: String) {
|
||||
}
|
||||
|
||||
class Handler() {
|
||||
fun Int.times(op: fun(): Unit) {
|
||||
fun Int.times(op: ()-> Unit) {
|
||||
for(i in 0..this)
|
||||
op()
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ fun StringBuilder.takeFirst(): Char {
|
||||
fun foo(expr: StringBuilder): Int {
|
||||
val c = expr.takeFirst()
|
||||
when(c) {
|
||||
0.chr => throw Exception("zero")
|
||||
else => throw Exception("nonzero" + c)
|
||||
0.chr -> throw Exception("zero")
|
||||
else -> throw Exception("nonzero" + c)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user