KT-37604 Use proper type when generating constructor call

This commit is contained in:
Dmitry Petrov
2020-03-20 20:02:21 +03:00
parent 95857c5af4
commit afacb4b4b2
8 changed files with 75 additions and 1 deletions
@@ -0,0 +1,42 @@
// IGNORE_BACKEND_FIR: JVM_IR
fun useUnit(fn: () -> Unit) {
fn.invoke()
}
var cInit = false
class C {
init {
cInit = true
}
}
var cWithDefaultInit = false
class CWithDefault(x: Int = 1) {
init {
cWithDefaultInit = true
}
}
var cWithVarargInit = false
class CWithVararg(vararg x: Int) {
init {
cWithVarargInit = true
}
}
fun box(): String {
useUnit(::C)
if (!cInit) throw AssertionError("cInit")
useUnit(::CWithDefault)
if (!cWithDefaultInit) throw AssertionError("cWithDefaultInit")
useUnit(::CWithVararg)
if (!cWithVarargInit) throw AssertionError("cWithVarargInit")
return "OK"
}