GreatSyntacticShift: Codegen testdata fixed

This commit is contained in:
Andrey Breslav
2011-12-20 22:56:13 +04:00
parent 41fd43b5e5
commit 6aad3b2662
67 changed files with 151 additions and 151 deletions
@@ -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)
}
}