[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,26 @@
fun box(): String {
KlassA({})
KlassB()
return "OK"
}
class KlassA(arg: (() -> Unit)?) {
var func: (() -> Unit)? = arg
init {
if (func != null) {
<!SMARTCAST_IMPOSSIBLE!>func<!>()
}
}
}
class KlassB {
var func: (() -> Unit)?
init {
if (true) {
func = {}
<!UNSAFE_IMPLICIT_INVOKE_CALL!>func<!>()
} else {
func = null
}
}
}
@@ -0,0 +1,26 @@
fun box(): String {
KlassA({})
KlassB()
return "OK"
}
class KlassA(arg: (() -> Unit)?) {
var func: (() -> Unit)? = arg
init {
if (func != null) {
<!UNSAFE_IMPLICIT_INVOKE_CALL!>func<!>()
}
}
}
class KlassB {
var func: (() -> Unit)?
init {
if (true) {
func = {}
<!UNSAFE_IMPLICIT_INVOKE_CALL!>func<!>()
} else {
func = null
}
}
}
@@ -0,0 +1,12 @@
fun box(): String {
Klass({})
return "OK"
}
class Klass(var func: (() -> Unit)?) {
init {
if (func != null) {
<!SMARTCAST_IMPOSSIBLE!>func<!>()
}
}
}
@@ -0,0 +1,12 @@
fun box(): String {
Klass({})
return "OK"
}
class Klass(var func: (() -> Unit)?) {
init {
if (func != null) {
<!UNSAFE_IMPLICIT_INVOKE_CALL!>func<!>()
}
}
}