Add test for KT-41254

It was fixed along with #KT-41005
This commit is contained in:
Mikhail Zarechenskiy
2020-08-20 15:43:48 +03:00
parent a6f301e84a
commit ced151f3af
8 changed files with 49 additions and 0 deletions
@@ -0,0 +1,14 @@
// IGNORE_BACKEND_FIR: JVM_IR
class Inv<T>(val x: T?)
fun <R> foo(f: () -> R?): Inv<R> {
val r = f()
if (r != null) throw Exception("fail, result is not null: $r")
return Inv(r)
}
fun box(): String {
val r: Inv<Unit> = foo { if (false) Unit else null }
return "OK"
}