Move tailrecPhase before defaultArgumentStubPhase
So that default values can be copied to the recursive call sites.
This commit is contained in:
committed by
max-kammerer
parent
6addb24e4b
commit
bdcd6f73b1
Vendored
+22
@@ -0,0 +1,22 @@
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
|
||||
var counter = 0
|
||||
fun inc() = counter++
|
||||
|
||||
tailrec fun test(x: Int = 0, y: Int = inc(), z: Int = inc()) {
|
||||
if (x * 2 != y + 1 || z - y != -1)
|
||||
throw IllegalArgumentException("x=$x y=$y z=$z")
|
||||
|
||||
if (x < 100000)
|
||||
test(z = inc(), x = (counter - 1)/2 + 1)
|
||||
}
|
||||
|
||||
fun box() : String {
|
||||
counter = 4
|
||||
test(1, 1, 0)
|
||||
|
||||
counter = 0
|
||||
test(-1, -3, -4)
|
||||
|
||||
return "OK"
|
||||
}
|
||||
Reference in New Issue
Block a user