[FE 1.0] Migrate most of warning/error pairs to DiagnosticFactoryForDeprecation
This commit is contained in:
+1
-1
@@ -7,6 +7,6 @@ object ChildB : Parent
|
||||
fun <@kotlin.internal.OnlyInputTypes T> select(a: T, b: T) {}
|
||||
|
||||
fun test() {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>select<!>(ChildA, ChildB) // should be error
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>select<!>(ChildA, ChildB) // should be error
|
||||
select<Any>(ChildA, ChildB) // should be ok
|
||||
}
|
||||
|
||||
+3
-3
@@ -15,7 +15,7 @@ fun <@kotlin.internal.OnlyInputTypes T : Base> fooB(a: T, b: T) {}
|
||||
|
||||
|
||||
fun usage(x: CX, y: CY) {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>foo<!>(x, y) // expected err, got err
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>fooA<!>(x, y) // expected err, got ok
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>fooB<!>(x, y) // expected err, got ok
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>foo<!>(x, y) // expected err, got err
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>fooA<!>(x, y) // expected err, got ok
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>fooB<!>(x, y) // expected err, got ok
|
||||
}
|
||||
|
||||
+2
-2
@@ -2,7 +2,7 @@
|
||||
// ISSUE: KT-29307
|
||||
|
||||
fun test_1(map: Map<String, String>) {
|
||||
val x = <!TYPE_INFERENCE_ONLY_INPUT_TYPES!>map[42]<!> // OK
|
||||
val x = <!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>map[42]<!> // OK
|
||||
}
|
||||
|
||||
open class A
|
||||
@@ -10,7 +10,7 @@ open class A
|
||||
class B : A()
|
||||
|
||||
fun test_2(map: Map<A, String>) {
|
||||
val x = <!TYPE_INFERENCE_ONLY_INPUT_TYPES!>map[42]<!>
|
||||
val x = <!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>map[42]<!>
|
||||
}
|
||||
|
||||
fun test_3(m: Map<*, String>) {
|
||||
|
||||
Vendored
+4
-4
@@ -35,12 +35,12 @@ fun test_4(list: List<Out<Int>>, x: Out<Int>, y: Out<Number>, z: Out<Any>) {
|
||||
|
||||
fun test_5(list: List<Inv<Number>>, x: Inv<Number>, y: Inv<Int>, z: Inv<Any>) {
|
||||
list.contains1(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(z)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(z)
|
||||
}
|
||||
|
||||
fun test_6(list: List<Inv<Int>>, x: Inv<Int>, y: Inv<Number>, z: Inv<Any>) {
|
||||
list.contains1(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(z)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(y)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(z)
|
||||
}
|
||||
|
||||
+2
-2
@@ -17,9 +17,9 @@ public fun <K, V> Map<K, V>.get1(key: Any?): Int = null!!
|
||||
public fun <@kotlin.internal.OnlyInputTypes K, V> Map<out K, V>.get1(key: K): V? = null!!
|
||||
|
||||
fun test(map: Map<Int, String>) {
|
||||
val a: Int = <!TYPE_MISMATCH!>listOf(1).<!TYPE_MISMATCH!><!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>("")<!><!>
|
||||
val a: Int = <!TYPE_MISMATCH!>listOf(1).<!TYPE_MISMATCH!><!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>("")<!><!>
|
||||
val b: Boolean = listOf(1).contains1(1)
|
||||
|
||||
val c: String? = map.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>get1<!>("")
|
||||
val c: String? = map.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>get1<!>("")
|
||||
val d: String? = map.get1(1)
|
||||
}
|
||||
|
||||
+1
-1
@@ -20,7 +20,7 @@ fun test(
|
||||
invOut.onlyOut(42)
|
||||
invOut.onlyOut(1L)
|
||||
|
||||
invOut.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>onlyOutUB<!>(<!TYPE_MISMATCH!>"str"<!>)
|
||||
invOut.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>onlyOutUB<!>(<!TYPE_MISMATCH!>"str"<!>)
|
||||
invStar.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>onlyOutUB<!>(0)
|
||||
invOut.onlyOutUB(42)
|
||||
invOut.onlyOutUB(1L)
|
||||
|
||||
+9
-9
@@ -16,7 +16,7 @@ class Out<out T>
|
||||
// -------------------------------------------------------
|
||||
|
||||
fun test_0(x: Inv2<in Number, out Number>, list: List<Inv2<Any, Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>foo<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>foo<!>(x)
|
||||
}
|
||||
|
||||
// ------------------------- Inv -------------------------
|
||||
@@ -26,27 +26,27 @@ fun test_1(x: Inv<Number>, list: List<Inv<Number>>) {
|
||||
}
|
||||
|
||||
fun test_2(x: Inv<Number>, list: List<Inv<Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_3(x: Inv<Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_4(x: Inv<in Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_5(x: Inv<in Number>, list: List<Inv<Number>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_6(x: Inv<in Number>, list: List<Inv<Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_7(x: Inv<out Number>, list: List<Inv<Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_8(x: Inv<out Number>, list: List<Inv<Number>>) {
|
||||
@@ -96,7 +96,7 @@ fun test_32(x: Inv<Number>, list: List<Inv<in Int>>) {
|
||||
}
|
||||
|
||||
fun test_33(x: Inv<Number>, list: List<Inv<in Any>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_34(x: Inv<Number>, list: List<Inv<out Number>>) {
|
||||
@@ -104,7 +104,7 @@ fun test_34(x: Inv<Number>, list: List<Inv<out Number>>) {
|
||||
}
|
||||
|
||||
fun test_35(x: Inv<Number>, list: List<Inv<out Int>>) {
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>contains1<!>(x)
|
||||
list.<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>contains1<!>(x)
|
||||
}
|
||||
|
||||
fun test_36(x: Inv<Number>, list: List<Inv<out Any>>) {
|
||||
|
||||
+7
-7
@@ -43,11 +43,11 @@ fun testOK(first: First, bound: Bound, second: Second) {
|
||||
}
|
||||
|
||||
fun testFail(first: First, bound: Bound, second: Second) {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(InvB(first), InvB(bound))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Inv(first), Inv(bound))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Out(first), Out(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(In(first), In(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(InB(first), InB(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(Out(Inv(first)), Out(Inv(second)))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>strictSelect<!>(In(Inv(first)), In(Inv(second)))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(InvB(first), InvB(bound))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(Inv(first), Inv(bound))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(Out(first), Out(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(In(first), In(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(InB(first), InB(second))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(Out(Inv(first)), Out(Inv(second)))
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>strictSelect<!>(In(Inv(first)), In(Inv(second)))
|
||||
}
|
||||
|
||||
+1
-1
@@ -5,7 +5,7 @@
|
||||
class Inv<T>
|
||||
class Out<out T>
|
||||
fun <T> foo(i: Inv<in T>, o: Out<T>) {
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>bar<!>(i, o)
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>bar<!>(i, o)
|
||||
}
|
||||
|
||||
fun <@kotlin.internal.OnlyInputTypes K> bar(r: Inv<out K>, o: Out<K>): K = TODO()
|
||||
|
||||
+1
-1
@@ -10,7 +10,7 @@ class D
|
||||
|
||||
fun test1(a: A, b: B, c: C) {
|
||||
assertEquals1(a, b)
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES!>assertEquals1<!>(b, c)
|
||||
<!TYPE_INFERENCE_ONLY_INPUT_TYPES_ERROR!>assertEquals1<!>(b, c)
|
||||
|
||||
assertEquals1(3, 3)
|
||||
assertEquals1(1 or 2, 2 or 1)
|
||||
|
||||
Reference in New Issue
Block a user