KT-2280 Recursive function declared in function results in VerifyError

#KT-2280 Fixed

A closure's constructor should not take an instance of itself as an
argument, because it would require caller to pass yet uninitialized
value. Instead it should initialize a corresponding field with 'this'
This commit is contained in:
Alexander Udalov
2012-07-31 19:05:38 +04:00
parent b883bf6ef5
commit dcd5cad427
5 changed files with 44 additions and 2 deletions
@@ -0,0 +1,7 @@
fun foo(s: String): String {
fun bar(count: Int): String =
if (count == 0) s else bar(count - 1)
return bar(239)
}
fun box(): String = foo("OK")