[FIR] Fix local RETURN_TYPE_MISMATCH with flexible Unit and multiple Unit returns

This commit is contained in:
Ivan Kochurkin
2023-09-20 15:02:46 +02:00
committed by Space Team
parent 4b9e15dfa8
commit b5acd1da6a
8 changed files with 97 additions and 3 deletions
@@ -0,0 +1,20 @@
// FIR_IDENTICAL
// FILE: JavaClass.java
@FunctionalInterface
public interface JavaClass<T> {
public T invoke();
}
// FILE: main.kt
fun main() {
JavaClass {
if (true) {
return@JavaClass
} else {
return@JavaClass
}
}
}
@@ -0,0 +1,11 @@
// FIR_IDENTICAL
fun <T> execute(block: () -> T): T = block()
fun main() {
execute {
if (true) return@execute
if (true) return@execute Unit
execute { Any() }
}
}