Closure conversion: simple tests work.

This commit is contained in:
Dmitry Petrov
2016-10-03 16:19:09 +03:00
parent 6bd27e52bc
commit 5ee2f87c4a
15 changed files with 425 additions and 44 deletions
+6
View File
@@ -0,0 +1,6 @@
fun foo(x: String): String {
fun bar(y: String) = x + y
return bar("K")
}
fun box() = foo("O")
+8
View File
@@ -0,0 +1,8 @@
fun <X : Any> foo(x: X): String {
fun <Y : Any> bar(y: Y) =
x.toString() + y.toString()
return bar("K")
}
fun box() = foo("O")
+11
View File
@@ -0,0 +1,11 @@
fun foo(x: String): String {
fun bar(y: String): String {
fun qux(z: String): String =
x + y + z
return qux("")
}
return bar("K")
}
fun box(): String =
foo("O")