K2: report empty intersection warnings from completion properly
This commit is contained in:
committed by
Space Team
parent
47fab61716
commit
a3f0e429e3
-41
@@ -1,41 +0,0 @@
|
||||
interface I
|
||||
open class C
|
||||
|
||||
fun completed(): String = "..."
|
||||
|
||||
fun <T> incomplete(): T = null!!
|
||||
|
||||
fun <T : I> incompatibleI(): T = null!!
|
||||
fun <T : C> incompatibleC(): T = null!!
|
||||
|
||||
val p = false
|
||||
|
||||
fun expectUnit(x: Unit) = x
|
||||
|
||||
fun test1() = run {
|
||||
if (p) return@run
|
||||
completed() // ok, not returned
|
||||
}
|
||||
|
||||
fun test2() = run {
|
||||
if (p) return@run
|
||||
incomplete() // ? either uninferred T or Unit
|
||||
}
|
||||
|
||||
fun test3() = run {
|
||||
if (p) return@run
|
||||
incompatibleI() // ? either uninferred T or error (Unit </: I)
|
||||
}
|
||||
|
||||
fun test4() = <!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>run<!> {
|
||||
if (p) return@run
|
||||
incompatibleC() // ? either uninferred T or error (Unit </: C)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
// all ok
|
||||
expectUnit(test1())
|
||||
expectUnit(test2())
|
||||
expectUnit(test3())
|
||||
expectUnit(test4())
|
||||
}
|
||||
+1
@@ -1,3 +1,4 @@
|
||||
// FIR_IDENTICAL
|
||||
interface I
|
||||
open class C
|
||||
|
||||
|
||||
Reference in New Issue
Block a user