Add diagnostics to test data from NI
This commit is contained in:
@@ -20,11 +20,11 @@ operator fun Impl2.unaryMinus() = Impl2()
|
||||
// See also KT-10384: in non-error functions, as is necessary!
|
||||
fun add1(x: Impl2, y: Base): Impl1 = x as Base + y
|
||||
|
||||
fun error1(x: Impl2, y: Base): Impl1 = <!TYPE_MISMATCH!>x + y<!>
|
||||
fun error1(x: Impl2, y: Base): Impl1 = <!NI;TYPE_MISMATCH, TYPE_MISMATCH!>x + y<!>
|
||||
|
||||
fun add2(x: Base, y: Impl2): Impl1 = x + y as Base
|
||||
|
||||
fun error2(x: Base, y: Impl2): Impl1 = <!TYPE_MISMATCH!>x + y<!>
|
||||
fun error2(x: Base, y: Impl2): Impl1 = <!NI;TYPE_MISMATCH, TYPE_MISMATCH!>x + y<!>
|
||||
|
||||
fun minus3(x: Impl2): Impl1 = -(x as Base)
|
||||
|
||||
|
||||
@@ -6,7 +6,7 @@ fun runWithoutReturn(r: () -> Unit) = r()
|
||||
fun testRun() {
|
||||
run {
|
||||
1 <!USELESS_CAST!>as Any<!>
|
||||
1 as Any
|
||||
1 <!NI;USELESS_CAST!>as Any<!>
|
||||
}
|
||||
|
||||
run<Any> {
|
||||
@@ -17,11 +17,11 @@ fun testRun() {
|
||||
fun foo(): Int = 1
|
||||
|
||||
run {
|
||||
foo() as Any
|
||||
foo() <!NI;USELESS_CAST!>as Any<!>
|
||||
}
|
||||
|
||||
run {
|
||||
(if (true) 1 else 2) as Any
|
||||
(if (true) 1 else 2) <!NI;USELESS_CAST!>as Any<!>
|
||||
}
|
||||
|
||||
run<Int?> {
|
||||
@@ -36,17 +36,17 @@ fun testRun() {
|
||||
}
|
||||
|
||||
fun testReturn(): Number {
|
||||
run { 1 as Number }
|
||||
run { 1 <!NI;USELESS_CAST!>as Number<!> }
|
||||
return run { 1 <!USELESS_CAST!>as Number<!> }
|
||||
}
|
||||
|
||||
fun <T> testDependent() {
|
||||
listOf(1).map {
|
||||
it <!USELESS_CAST!>as Any<!>
|
||||
it as Any
|
||||
it <!NI;USELESS_CAST!>as Any<!>
|
||||
}
|
||||
|
||||
listOf<T>().map { it as Any? }
|
||||
listOf<T>().map { it <!NI;USELESS_CAST!>as Any?<!> }
|
||||
}
|
||||
|
||||
fun <T> listOf(vararg elements: T): List<T> = TODO()
|
||||
|
||||
@@ -11,7 +11,7 @@ fun test(x: Int?) {
|
||||
val a7: Number? = 1 <!USELESS_CAST!>as? Number<!>
|
||||
|
||||
run { x <!USELESS_CAST!>as? Int<!> }
|
||||
run { x as? Number }
|
||||
run { x <!NI;USELESS_CAST!>as? Number<!> }
|
||||
|
||||
foo(x as? Number)
|
||||
|
||||
|
||||
+1
-1
@@ -2,6 +2,6 @@
|
||||
class Array<E>(e: E) {
|
||||
val k = Array(1) {
|
||||
1 <!USELESS_CAST!>as Any<!>
|
||||
e as Any?
|
||||
e <!NI;USELESS_CAST!>as Any?<!>
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user