Files
kotlin-fork/backend.native/tests/codegen/function/defaults1.kt
T
Vasily Levchenko a8caf7c7d8 TEST: test for default parameters
(cherry picked from commit 7999d68d812aedd5863f04b7fd2171e284b8f332)
2017-01-13 13:42:02 +03:00

9 lines
193 B
Kotlin

fun foo(x:Int = 0, y:Int = x + 1, z:Int = x + y + 1) = x + y + z
fun main(arg:Array<String>) {
val v = foo()
if (v != 3) {
println("test failed $v expected 3")
throw Error()
}
}