TEST: test for default parameters
(cherry picked from commit 7999d68d812aedd5863f04b7fd2171e284b8f332)
This commit is contained in:
committed by
vvlevchenko
parent
b994fabadd
commit
a8caf7c7d8
@@ -0,0 +1,12 @@
|
||||
fun foo(a:Int = 2, b:String = "Hello", c:Int = 4):String = "$b-$c$a"
|
||||
fun foo(a:Int = 3, b:Int = a + 1, c:Int = a + b) = a + b + c
|
||||
|
||||
fun main(arg:Array<String>){
|
||||
val a = foo(b="Universe")
|
||||
if (a != "Universe-42")
|
||||
throw Error()
|
||||
|
||||
val b = foo(b = 5)
|
||||
if (b != (/* a = */ 3 + /* b = */ 5 + /* c = */ (3 + 5)))
|
||||
throw Error()
|
||||
}
|
||||
Reference in New Issue
Block a user