[NI] Consider intersection type with number type as Nothing
Currently, only for "in": In<in Int & A> == In<in Nothing> == In<*> #KT-37302 Fixed
This commit is contained in:
+1
-1
@@ -18,7 +18,7 @@ fun test() {
|
||||
// ISSUE: KT-27999
|
||||
// ISSUE: KT-30244
|
||||
fun test_1() {
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("() -> {Comparable<{Int & String}> & java.io.Serializable}")!>select(
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("() -> {Comparable<*> & java.io.Serializable}")!>select(
|
||||
{ 1 },
|
||||
{ "" }
|
||||
)<!>
|
||||
|
||||
+2
-2
@@ -107,7 +107,7 @@ fun case_8() {
|
||||
val x3 = Test.id(A(null))
|
||||
|
||||
val result_1 = select(x1, x2, x3)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out {Comparable<{Int & String}> & java.io.Serializable}?>?")!>result_1<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out {Comparable<*>? & java.io.Serializable?}>?")!>result_1<!>
|
||||
}
|
||||
|
||||
fun case_9() {
|
||||
@@ -116,7 +116,7 @@ fun case_9() {
|
||||
val x3 = A(Test.id(A('s')))
|
||||
|
||||
val result_1 = select(x1, x2, x3)
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out A<out {Comparable<{Char & Int & String}> & java.io.Serializable}>?>")!>result_1<!>
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("A<out A<out {Comparable<*> & java.io.Serializable}>?>")!>result_1<!>
|
||||
}
|
||||
|
||||
fun case_10() {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
package
|
||||
|
||||
public val test1: C<kotlin.Int> /* = Cons<kotlin.Int> */
|
||||
public val test2: C<kotlin.Number> /* = Cons<kotlin.Number> */
|
||||
public val test2: Cons<out kotlin.Any?>
|
||||
|
||||
public final class Cons</*0*/ T : kotlin.Number> {
|
||||
public constructor Cons</*0*/ T : kotlin.Number>(/*0*/ head: T, /*1*/ tail: Cons<T>?)
|
||||
|
||||
Vendored
+2
-2
@@ -2,7 +2,7 @@ package
|
||||
|
||||
public val test0: P<kotlin.Int, kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test0p2: P2<kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test0p2a: Pair<out kotlin.Any, out kotlin.Any>
|
||||
public val test0p2a: Pair<out kotlin.Any?, out kotlin.Any?>
|
||||
public val test0pr: PR<kotlin.String, kotlin.Int> /* = Pair<kotlin.Int, kotlin.String> */
|
||||
public val test1: P<kotlin.Int, kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test1p2: P2<kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
@@ -13,7 +13,7 @@ public val test2pr: PR<kotlin.Int, kotlin.String> /* = Pair<kotlin.String, kotli
|
||||
public val test2pra: PR<kotlin.String, kotlin.Int> /* = Pair<kotlin.Int, kotlin.String> */
|
||||
public val test3: P<kotlin.Int, kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test3p2: P2<kotlin.Int> /* = Pair<kotlin.Int, kotlin.Int> */
|
||||
public val test3pr: Pair<out kotlin.Any, out kotlin.Any>
|
||||
public val test3pr: Pair<out kotlin.Any?, out kotlin.Any?>
|
||||
public val testMP0: MP<kotlin.Int> /* = MyPair<kotlin.String, kotlin.Int> */
|
||||
public val testMP1: MP<kotlin.String> /* = MyPair<kotlin.String, kotlin.String> */
|
||||
public val testMP2: MP<kotlin.String> /* = MyPair<kotlin.String, kotlin.String> */
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
|
||||
fun test() {
|
||||
val u = when (true) {
|
||||
true -> 42
|
||||
else -> 1.0
|
||||
}
|
||||
|
||||
assertEquals(42, u)
|
||||
}
|
||||
+1
-2
@@ -1,4 +1,3 @@
|
||||
// FIR_IDENTICAL
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
import kotlin.test.assertEquals
|
||||
@@ -9,5 +8,5 @@ fun test() {
|
||||
else -> 1.0
|
||||
}
|
||||
|
||||
assertEquals(42, u)
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_WARNING!>assertEquals<!>(42, u)
|
||||
}
|
||||
Reference in New Issue
Block a user