Revert "[FIR] Enable ForbidInferringTypeVariablesIntoEmptyIntersection in 2.0"
^KT-66196 Fixed
Keep it a warning in 2.0
This reverts commit be232d3e6f.
This commit is contained in:
+1
-1
@@ -31,7 +31,7 @@ fun <E> intersect(vararg x: In<E>): E = null as E
|
||||
fun test() {
|
||||
val ret = build {
|
||||
emit("1")
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>intersect<!>(getIn(), getIn())
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>intersect<!>(getIn(), getIn())
|
||||
intersect(getIn(), Test.foo(getIn()))
|
||||
intersect(Test.foo(getIn()), Test.foo(getIn()))
|
||||
intersect(Test.foo(getIn()), getIn())
|
||||
|
||||
+1
-1
@@ -29,7 +29,7 @@ fun test3() = run {
|
||||
|
||||
fun test4() = run {
|
||||
if (p) return@run
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>incompatibleC<!>() // ? either uninferred T or error (Unit </: C)
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>incompatibleC<!>() // ? either uninferred T or error (Unit </: C)
|
||||
}
|
||||
|
||||
fun main() {
|
||||
|
||||
Vendored
+1
-1
@@ -47,7 +47,7 @@ fun test(i: Inv<Nothing>, iUnit: Inv<Unit>) {
|
||||
|
||||
if (iUnit is String) {
|
||||
launch {
|
||||
run(A.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>flexible<!>(iUnit)) { 42 }
|
||||
run(A.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>flexible<!>(iUnit)) { 42 }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -4,5 +4,5 @@ open class A
|
||||
abstract class B {
|
||||
fun test(current: A): A? =
|
||||
// K2 reports empty intersection here due to the smart cast from A to B, where A & B aren't compatible
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR("K; B?, A?; multiple incompatible classes; : B, A")!>if (current === this) current else null<!>
|
||||
<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING("K; B?, A?; multiple incompatible classes; : B, A")!>if (current === this) current else null<!>
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/kt45461.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, Int (multiple incompatible classes). This will become an error in Kotlin 2.0
|
||||
/kt45461.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, Int (multiple incompatible classes). This will become an error in a future release
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^^^^^^^
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/kt45461.kt:(245,252): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, kotlin.Int (multiple incompatible classes). This will become an error in Kotlin 2.0.
|
||||
/kt45461.kt:(245,252): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, kotlin.Int (multiple incompatible classes). This will become an error in a future release.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/kt45461_12.kt:14:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number). This will become an error in Kotlin 2.0
|
||||
/kt45461_12.kt:14:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number). This will become an error in a future release
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^^^^^^^
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
/kt45461_12.kt:(296,303): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, K (multiple incompatible classes: kotlin/String, kotlin/Number). This will become an error in Kotlin 2.0.
|
||||
/kt45461_12.kt:(296,303): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, K (multiple incompatible classes: kotlin/String, kotlin/Number). This will become an error in a future release.
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
/kt45461_2.kt:10:10: warning: 'Int' is a final type, and thus a value of the type parameter is predetermined
|
||||
fun <K : Int> main() {
|
||||
^^^
|
||||
/kt45461_2.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Int). This will become an error in Kotlin 2.0
|
||||
/kt45461_2.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Int). This will become an error in a future release
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^^^^^^^
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
/kt45461_2.kt:(198,201): warning: Type 'kotlin.Int' is final, so the value of the type parameter is predetermined.
|
||||
|
||||
/kt45461_2.kt:(253,260): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, K (multiple incompatible classes: kotlin/String, kotlin/Int). This will become an error in Kotlin 2.0.
|
||||
/kt45461_2.kt:(253,260): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, K (multiple incompatible classes: kotlin/String, kotlin/Int). This will become an error in a future release.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/kt45461_5.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number). This will become an error in Kotlin 2.0
|
||||
/kt45461_5.kt:12:19: warning: type argument for a type parameter S can't be inferred because it has incompatible upper bounds: String, K (multiple incompatible classes: String, Number). This will become an error in a future release
|
||||
Bar<String>().takeFoo(foo) // error in 1.3.72, no error in 1.4.31
|
||||
^^^^^^^
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -1 +1 @@
|
||||
/kt45461_5.kt:(269,276): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, K (multiple incompatible classes: kotlin/String, kotlin/Number). This will become an error in Kotlin 2.0.
|
||||
/kt45461_5.kt:(269,276): warning: Type argument for type parameter 'S' cannot be inferred because it has incompatible upper bounds: kotlin.String, K (multiple incompatible classes: kotlin/String, kotlin/Number). This will become an error in a future release.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/kt48765.kt:10:13: warning: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: String, Number (multiple incompatible classes). This will become an error in Kotlin 2.0
|
||||
/kt48765.kt:10:13: warning: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: String, Number (multiple incompatible classes). This will become an error in a future release
|
||||
B().foo(x, foo())
|
||||
^^^
|
||||
/kt48765.kt:14:9: warning: 'String' is a final type, and thus a value of the type parameter is predetermined
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/kt48765.kt:(282,285): warning: Type argument for type parameter 'T' cannot be inferred because it has incompatible upper bounds: kotlin.String, kotlin.Number (multiple incompatible classes). This will become an error in Kotlin 2.0.
|
||||
/kt48765.kt:(282,285): warning: Type argument for type parameter 'T' cannot be inferred because it has incompatible upper bounds: kotlin.String, kotlin.Number (multiple incompatible classes). This will become an error in a future release.
|
||||
|
||||
/kt48765.kt:(345,351): warning: Type 'kotlin.String' is final, so the value of the type parameter is predetermined.
|
||||
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@ fun box(): String {
|
||||
return try {
|
||||
val range1 = 0..1
|
||||
range1 <!CAST_NEVER_SUCCEEDS!>as<!> List<Double>
|
||||
range1.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_ERROR!>joinToString<!> { "" }
|
||||
range1.<!INFERRED_TYPE_VARIABLE_INTO_EMPTY_INTERSECTION_WARNING!>joinToString<!> { "" }
|
||||
} catch (e: java.lang.ClassCastException) {
|
||||
"OK"
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/kt49661.kt:11:5: warning: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: Foo, Int (multiple incompatible classes). This will become an error in Kotlin 2.0
|
||||
/kt49661.kt:11:5: warning: type argument for a type parameter T can't be inferred because it has incompatible upper bounds: Foo, Int (multiple incompatible classes). This will become an error in a future release
|
||||
f<Int> { g() }
|
||||
^
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/kt49661.fir.kt:(243,244): warning: Type argument for type parameter 'T' cannot be inferred because it has incompatible upper bounds: Foo, kotlin.Int (multiple incompatible classes). This will become an error in Kotlin 2.0.
|
||||
/kt49661.fir.kt:(243,244): warning: Type argument for type parameter 'T' cannot be inferred because it has incompatible upper bounds: Foo, kotlin.Int (multiple incompatible classes). This will become an error in a future release.
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
/selectFromCovariantAndContravariantTypes.kt:17:5: warning: type argument for a type parameter V can't be inferred because it has incompatible upper bounds: A, B (multiple incompatible classes). This will become an error in Kotlin 2.0
|
||||
/selectFromCovariantAndContravariantTypes.kt:17:5: warning: type argument for a type parameter V can't be inferred because it has incompatible upper bounds: A, B (multiple incompatible classes). This will become an error in a future release
|
||||
genericIn(select(a, b))
|
||||
^^^^^^^^^
|
||||
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
/selectFromCovariantAndContravariantTypes.kt:(335,344): warning: Type argument for type parameter 'V' cannot be inferred because it has incompatible upper bounds: A, B (multiple incompatible classes). This will become an error in Kotlin 2.0.
|
||||
/selectFromCovariantAndContravariantTypes.kt:(335,344): warning: Type argument for type parameter 'V' cannot be inferred because it has incompatible upper bounds: A, B (multiple incompatible classes). This will become an error in a future release.
|
||||
|
||||
Reference in New Issue
Block a user