[NI] Don't discriminate Nothing-type from resulting ones

^KT-32106 Fixed
This commit is contained in:
Mikhail Zarechenskiy
2019-06-21 13:28:05 +03:00
committed by Pavel Kirpichenkov
parent a8e9a6a1d0
commit ae1630f376
21 changed files with 55 additions and 32 deletions
@@ -25,5 +25,5 @@ fun test(s: SelectorFor<State>): Double {
val e = s { return p1 }
e checkType { _<AbstractSelector<State, Nothing>>() }
<!OI;UNREACHABLE_CODE!>return<!> null!!
<!UNREACHABLE_CODE!>return<!> null!!
}
@@ -0,0 +1,12 @@
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_VALUE
class Out<out T : Any>(result: T?)
fun main() {
val a = Out(null)
<!DEBUG_INFO_EXPRESSION_TYPE("Out<kotlin.Nothing>")!>a<!>
var b: Out<Int>? = null
b = a
}
@@ -0,0 +1,10 @@
package
public fun main(): kotlin.Unit
public final class Out</*0*/ out T : kotlin.Any> {
public constructor Out</*0*/ out T : kotlin.Any>(/*0*/ result: T?)
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
@@ -1,12 +1,12 @@
// !LANGUAGE: +NewInference
// !WITH_NEW_INFERENCE
// !DIAGNOSTICS: -UNUSED_PARAMETER -UNUSED_VARIABLE
fun <K> select2(x: K, y: K): K = TODO()
fun <K> select3(x: K, y: K, z: K): K = TODO()
fun test2(f: ((String) -> Int)?) {
val a0: ((Int) -> Int)? = select2({ it -> it }, null)
val b0: ((Nothing) -> Unit)? = select2({ it -> <!UNUSED_EXPRESSION!>it<!> }, null)
val a0: ((Int) -> Int)? = select2(<!TYPE_MISMATCH!>{ <!OI;CANNOT_INFER_PARAMETER_TYPE!>it<!> -> <!OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!> }<!>, null)
val b0: ((Nothing) -> Unit)? = select2(<!TYPE_MISMATCH!>{ <!OI;CANNOT_INFER_PARAMETER_TYPE!>it<!> -> <!OI;DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>it<!> }<!>, null)
select3({ it.length }, f, null)
}