Initializer default values in 'tailrec' method in proper order
#KT-31540 Fixed
This commit is contained in:
Vendored
+1
-1
@@ -1,5 +1,5 @@
|
||||
// !LANGUAGE: +ProperComputationOrderOfTailrecDefaultParameters
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
// IGNORE_BACKEND: JVM
|
||||
|
||||
var counter = 0
|
||||
fun inc() = counter++
|
||||
|
||||
Vendored
+2
@@ -1,3 +1,5 @@
|
||||
// !LANGUAGE: +ProperComputationOrderOfTailrecDefaultParameters
|
||||
// Flag above doesn't matter cause 1 default value is passed explicitly in tail recursion call
|
||||
// DONT_RUN_GENERATED_CODE: JS
|
||||
|
||||
var counter = 0
|
||||
|
||||
Vendored
+17
@@ -0,0 +1,17 @@
|
||||
// !LANGUAGE: -ProperComputationOrderOfTailrecDefaultParameters
|
||||
// TARGET_BACKEND: JVM
|
||||
// IGNORE_BACKEND: JVM_IR
|
||||
|
||||
var counter = 0
|
||||
fun calc(counter: Int) = if (counter % 2 == 0) "K" else "O"
|
||||
|
||||
<!TAILREC_WITH_DEFAULTS!>tailrec fun test(x: Int, y: String = calc(counter++), z: String = calc(counter++)): String<!> {
|
||||
if (x > 0)
|
||||
return y + z
|
||||
|
||||
return test(x + 1)
|
||||
}
|
||||
|
||||
fun box(): String {
|
||||
return test(0)
|
||||
}
|
||||
Vendored
+6
@@ -0,0 +1,6 @@
|
||||
package
|
||||
|
||||
public var counter: kotlin.Int
|
||||
public fun box(): kotlin.String
|
||||
public fun calc(/*0*/ counter: kotlin.Int): kotlin.String
|
||||
public tailrec fun test(/*0*/ x: kotlin.Int, /*1*/ y: kotlin.String = ..., /*2*/ z: kotlin.String = ...): kotlin.String
|
||||
Reference in New Issue
Block a user