[tests] Add test data for KT-63705

This commit is contained in:
Stanislav Ruban
2023-11-30 10:28:05 +01:00
committed by Space Team
parent fb9bf1782e
commit b275aeb39d
8 changed files with 144 additions and 0 deletions
@@ -0,0 +1,29 @@
// IGNORE_BACKEND_K1: ANY
// ISSUE: KT-63705
fun box(): String {
KlassA({})
KlassB()
return "OK"
}
class KlassA(arg: (() -> Unit)?) {
val func: (() -> Unit)? = arg
init {
if (func != null) {
func()
}
}
}
class KlassB {
val func: (() -> Unit)?
init {
if (true) {
func = {}
func()
} else {
func = null
}
}
}
@@ -0,0 +1,15 @@
// IGNORE_BACKEND_K1: ANY
// ISSUE: KT-63705
fun box(): String {
Klass({})
return "OK"
}
class Klass(val func: (() -> Unit)?) {
init {
if (func != null) {
func()
}
}
}
@@ -0,0 +1,12 @@
fun box(): String {
Klass({})
return "OK"
}
class Klass(func: (() -> Unit)?) {
init {
if (func != null) {
func()
}
}
}
@@ -0,0 +1,12 @@
fun box(): String {
Klass({})
return "OK"
}
class Klass {
constructor(func: (() -> Unit)?) {
if (func != null) {
func()
}
}
}