JS: refactor generation of functions with optional parameters. Fix #KT-7302, #KT-13888

This commit is contained in:
Alexey Andreev
2016-09-16 15:40:12 +03:00
parent 4b3cf432dc
commit d2050ace72
24 changed files with 428 additions and 256 deletions
@@ -0,0 +1,28 @@
package foo
open class A {
open fun foo(x: Int = 20, y: Int = 3) = x + y
}
open class B : A() {
override fun foo(x: Int, y: Int) = 0
fun bar1() = super.foo()
fun bar2() = super.foo(30)
fun bar3() = super.foo(y = 4)
}
fun box(): String {
val v1 = B().bar1()
if (v1 != 23) return "fail1: $v1"
val v2 = B().bar2()
if (v2 != 33) return "fail2: $v2"
val v3 = B().bar3()
if (v3 != 24) return "fail3: $v3"
return "OK"
}