KT-13043: fix translation of super call from secondary constructor when base constructor has default arguments

This commit is contained in:
Alexey Andreev
2016-07-08 20:06:08 +03:00
parent b00b0caa9b
commit c767b3d0ac
7 changed files with 70 additions and 7 deletions
@@ -0,0 +1,16 @@
package foo
enum class A {
B(2);
val c: Int
constructor (a: Int, b: Int = 3) {
c = a + b
}
}
fun box(): String {
assertEquals(5, A.B.c)
return "OK"
}
@@ -0,0 +1,16 @@
package foo
open class Base(a: Int, b: Int = 3) {
val c: Int
init {
c = a + b
}
}
class Derived(a: Int) : Base(a)
fun box(): String {
assertEquals(5, Derived(2).c)
return "OK"
}
@@ -0,0 +1,18 @@
package foo
open class Base {
val c: Int
constructor(a: Int, b: Int = 3) {
c = a + b
}
}
class Derived : Base {
constructor(a: Int) : super(a)
}
fun box(): String {
assertEquals(5, Derived(2).c)
return "OK"
}