Remove OI/NI attributes from test data

This commit is contained in:
Denis.Zharkov
2021-05-24 12:42:39 +03:00
committed by teamcityserver
parent 2ecba6ac39
commit ddbdfafa79
441 changed files with 1005 additions and 1037 deletions
@@ -2,12 +2,12 @@ fun foo(): String {
var s: String?
s = null
<!DEBUG_INFO_CONSTANT!>s<!>?.length
<!DEBUG_INFO_CONSTANT{OI}!>s<!><!UNSAFE_CALL!>.<!>length
s<!UNSAFE_CALL!>.<!>length
if (<!SENSELESS_COMPARISON!><!DEBUG_INFO_CONSTANT!>s<!> == null<!>) return <!ALWAYS_NULL!>s<!>!!
var t: String? = "y"
if (t == null) t = "x"
var x: Int? = null
if (x == null) <!TYPE_MISMATCH!><!DEBUG_INFO_CONSTANT{OI}!>x<!> += null<!>
if (x == null) <!TYPE_MISMATCH!>x += null<!>
return <!DEBUG_INFO_SMARTCAST!>t<!> + s
}
@@ -15,7 +15,7 @@ fun String?.gav() {}
fun bar(s: String?) {
if (s != null) return
<!DEBUG_INFO_CONSTANT{OI}!>s<!>.gav()
s.gav()
<!DEBUG_INFO_CONSTANT!>s<!> <!USELESS_CAST!>as? String<!>
<!DEBUG_INFO_CONSTANT!>s<!> <!USELESS_CAST!>as String?<!>
<!ALWAYS_NULL!>s<!> as String
@@ -10,7 +10,6 @@ public class My {
fun test() {
val my = My.create()
if (my == null) {
<!DEBUG_INFO_CONSTANT{OI}!>my<!><!UNSAFE_CALL!>.<!>foo()
my<!UNSAFE_CALL!>.<!>foo()
}
}
@@ -40,7 +40,7 @@ fun f(a: SomeClass?) {
if (aa as? SomeSubClass != null) {
aa = null
// 'aa' cannot be cast to SomeSubClass
<!DEBUG_INFO_CONSTANT{OI}!>aa<!><!UNSAFE_CALL!>.<!>hashCode()
aa<!UNSAFE_CALL!>.<!>hashCode()
aa.<!UNRESOLVED_REFERENCE!>foo<!>
(<!DEBUG_INFO_CONSTANT!>aa<!> as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
(<!ALWAYS_NULL!>aa<!> as SomeSubClass).foo
@@ -49,7 +49,7 @@ fun f(a: SomeClass?) {
aa = null
if (b != null) {
// 'aa' cannot be cast to SomeSubClass
<!DEBUG_INFO_CONSTANT{OI}!>aa<!><!UNSAFE_CALL!>.<!>hashCode()
aa<!UNSAFE_CALL!>.<!>hashCode()
aa.<!UNRESOLVED_REFERENCE!>foo<!>
(<!DEBUG_INFO_CONSTANT!>aa<!> as? SomeSubClass)<!UNSAFE_CALL!>.<!>foo
(<!ALWAYS_NULL!>aa<!> as SomeSubClass).foo
@@ -15,12 +15,12 @@ fun foo(x : String?, y : String?) {
else {
// y == null but x != y
<!DEBUG_INFO_SMARTCAST!>x<!>.length
<!DEBUG_INFO_CONSTANT{OI}!>y<!><!UNSAFE_CALL!>.<!>length
y<!UNSAFE_CALL!>.<!>length
}
if (y == null && x != <!DEBUG_INFO_CONSTANT!>y<!>) {
// y == null but x != y
<!DEBUG_INFO_SMARTCAST!>x<!>.length
<!DEBUG_INFO_CONSTANT{OI}!>y<!><!UNSAFE_CALL!>.<!>length
y<!UNSAFE_CALL!>.<!>length
}
else {
x<!UNSAFE_CALL!>.<!>length
@@ -6,7 +6,7 @@ fun foo(x: String?, y: String?, z: String?, w: String?) {
if (x != null || y != null || (<!DEBUG_INFO_CONSTANT!>x<!> != z && <!DEBUG_INFO_CONSTANT!>y<!> != z))
z<!UNSAFE_CALL!>.<!>length
else
<!DEBUG_INFO_CONSTANT{OI}!>z<!><!UNSAFE_CALL!>.<!>length
z<!UNSAFE_CALL!>.<!>length
if (x == null || y == null || (x != z && y != z))
z<!UNSAFE_CALL!>.<!>length
else
@@ -17,7 +17,7 @@ fun foo(list: StringList, arg: Unstable) {
list.remove(arg.first)
if (arg.first?.isEmpty() ?: false) {
// Should be still resolved to extension, without smart cast or smart cast impossible
list.remove(<!SMARTCAST_IMPOSSIBLE{OI}!>arg.first<!>)
list.remove(arg.first)
}
}
@@ -35,6 +35,6 @@ fun bar(list: BooleanList, arg: UnstableBoolean) {
list.remove(arg.first)
if (arg.first ?: false) {
// Should be still resolved to extension, without smart cast or smart cast impossible
list.remove(<!SMARTCAST_IMPOSSIBLE{OI}!>arg.first<!>)
list.remove(arg.first)
}
}
@@ -16,7 +16,7 @@ interface C: A
fun test(a: A, b: B, c: C) {
if (a is B && a is C) {
val d: C = id(<!DEBUG_INFO_SMARTCAST{OI}!>a<!>)
val d: C = id(a)
val e: Any = id(a)
val f = id(a)
checkSubtype<A>(f)
@@ -30,7 +30,7 @@ fun test(a: A, b: B, c: C) {
val k = three(a, b, c)
checkSubtype<A>(k)
checkSubtype<B>(<!TYPE_MISMATCH!>k<!>)
val l: Int = <!TYPE_INFERENCE_EXPECTED_TYPE_MISMATCH{OI}, TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}, TYPE_MISMATCH{NI}!>three(a, b, c)<!>
val l: Int = <!TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH, TYPE_MISMATCH!>three(a, b, c)<!>
use(d, e, f, g, h, k, l)
}
@@ -40,11 +40,11 @@ fun <T> foo(t: T, l: MutableList<T>): T = t
fun testErrorMessages(a: A, ml: MutableList<String>) {
if (a is B && a is C) {
<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS{OI}!>foo<!>(a, <!TYPE_MISMATCH{NI}!>ml<!>)
foo(a, <!TYPE_MISMATCH!>ml<!>)
}
if(a is C) {
<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS{OI}!>foo<!>(a, <!TYPE_MISMATCH{NI}!>ml<!>)
foo(a, <!TYPE_MISMATCH!>ml<!>)
}
}
@@ -2,7 +2,7 @@
fun test(a: MutableList<out Int?>?) {
if (a != null) {
val b = <!DEBUG_INFO_SMARTCAST{OI}!>a<!>[0] // no SMARTCAST diagnostic
val b = a[0] // no SMARTCAST diagnostic
if (b != null) {
<!DEBUG_INFO_SMARTCAST!>b<!>.inc()
}
@@ -16,37 +16,37 @@ interface C {
fun foo(x: Any?) {
if (x is A && x is B) {
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!TYPE_MISMATCH{OI}, UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { _<String?>() }
}
if (x is B && x is A) {
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!TYPE_MISMATCH{OI}, UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { _<String?>() }
}
if (x is A && x is C) {
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { _<String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!TYPE_MISMATCH{OI}, UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><String?>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is C && x is A) {
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { _<String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!TYPE_MISMATCH{OI}, UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><String?>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is A && x is B && x is C) {
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { _<String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!TYPE_MISMATCH{OI}, UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><String?>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is B && x is A && x is C) {
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { _<String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!TYPE_MISMATCH{OI}, UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><String?>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
if (x is B && x is C && x is A) {
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { _<String>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!TYPE_MISMATCH{OI}, UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><String?>() }
<!DEBUG_INFO_SMARTCAST!>x<!>.foo().checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><String?>() }
}
}
+1 -1
View File
@@ -9,7 +9,7 @@ class Qwe<T : Any>(val a: T?) {
fun test1(obj: Qwe<*>) {
obj <!UNCHECKED_CAST!>as Qwe<T><!>
check(<!DEBUG_INFO_SMARTCAST{OI}!>obj<!>.a)
check(obj.a)
}
fun check(a: T?) {
+1 -1
View File
@@ -6,6 +6,6 @@ fun foo(a: MutableMap<String, String>, x: String?) {
}
fun foo1(a: MutableMap<String, String>, x: String?) {
<!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS{OI}!>a[<!TYPE_MISMATCH{NI}!>x<!>]<!> = x!!
a[<!TYPE_MISMATCH!>x<!>] = x!!
a[x<!UNNECESSARY_NOT_NULL_ASSERTION!>!!<!>] = <!DEBUG_INFO_SMARTCAST!>x<!>
}
+9 -9
View File
@@ -5,22 +5,22 @@ fun case_0() {
val z: Any? = 10
val y = z.run {
this as Int
<!DEBUG_INFO_SMARTCAST{NI}!>this<!> // error in NI: required Int, found Any?; just inferred to Any? in OI
<!DEBUG_INFO_SMARTCAST!>this<!> // error in NI: required Int, found Any?; just inferred to Any? in OI
}
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><Any?>() }
y checkType { <!TYPE_MISMATCH{OI}!>_<!><Int>() }
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
y checkType { _<Int>() }
}
fun case_1(z: Any?) {
val y = z.run {
when (this) {
is String -> return@run <!DEBUG_INFO_SMARTCAST{NI}!>this<!> // type mismatch in the new inference (required String, found Any?)
is String -> return@run <!DEBUG_INFO_SMARTCAST!>this<!> // type mismatch in the new inference (required String, found Any?)
is Float -> ""
else -> return@run ""
}
}
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><Any?>() }
y checkType { <!TYPE_MISMATCH{OI}!>_<!><kotlin.String>() }
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
y checkType { _<kotlin.String>() }
// y is inferred to Any?
}
@@ -39,12 +39,12 @@ fun case_2(z: Any?) {
fun case_3(z: Any?) {
val y = z.let {
when (it) {
is String -> return@let <!DEBUG_INFO_SMARTCAST{NI}!>it<!>
is String -> return@let <!DEBUG_INFO_SMARTCAST!>it<!>
is Float -> ""
else -> return@let ""
}
}
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER{NI}!>_<!><Any?>() }
y checkType { <!TYPE_MISMATCH{OI}!>_<!><kotlin.String>() }
y checkType { <!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>_<!><Any?>() }
y checkType { _<kotlin.String>() }
// y is inferred to String
}
@@ -12,14 +12,14 @@ val foo: Foo = run {
<!DEBUG_INFO_SMARTCAST!>x<!>
}
val foofoo: Foo = <!TYPE_INFERENCE_UPPER_BOUND_VIOLATED{OI}!>run<!> {
val foofoo: Foo = run {
val x = foo()
if (x == null) throw Exception()
<!DEBUG_INFO_SMARTCAST, TYPE_MISMATCH{NI}!>x<!>
<!DEBUG_INFO_SMARTCAST, TYPE_MISMATCH!>x<!>
}
val bar: Bar = <!TYPE_MISMATCH{NI}!><!TYPE_INFERENCE_CONFLICTING_SUBSTITUTIONS{OI}!>run<!> {
val bar: Bar = <!TYPE_MISMATCH!>run {
val x = foo()
if (x == null) throw Exception()
<!DEBUG_INFO_SMARTCAST{NI}, TYPE_MISMATCH, TYPE_MISMATCH!>x<!>
<!DEBUG_INFO_SMARTCAST, TYPE_MISMATCH, TYPE_MISMATCH!>x<!>
}<!>
@@ -68,5 +68,5 @@ fun gau(flag: Boolean, arg: String?) {
}
}
<!DEBUG_INFO_SMARTCAST{NI}!>x<!><!UNSAFE_CALL{OI}!>.<!>hashCode()
<!DEBUG_INFO_SMARTCAST!>x<!>.hashCode()
}
@@ -4,7 +4,7 @@ fun foo() {
v = "abc"
<!DEBUG_INFO_SMARTCAST!>v<!>.length
v = null
<!DEBUG_INFO_CONSTANT{OI}!>v<!><!UNSAFE_CALL!>.<!>length
v<!UNSAFE_CALL!>.<!>length
v = "abc"
<!DEBUG_INFO_SMARTCAST!>v<!>.length
}
@@ -5,7 +5,7 @@ fun foo() {
val y = x
x = null
if (y != null) {
<!DEBUG_INFO_CONSTANT{OI}!>x<!><!UNSAFE_CALL!>.<!>hashCode()
x<!UNSAFE_CALL!>.<!>hashCode()
}
}
@@ -22,7 +22,7 @@ fun bar(s: String?) {
val hashCode = ss?.hashCode()
ss = null
if (hashCode != null) {
<!DEBUG_INFO_CONSTANT{OI}!>ss<!><!UNSAFE_CALL!>.<!>hashCode()
ss<!UNSAFE_CALL!>.<!>hashCode()
}
}
@@ -75,5 +75,5 @@ fun test6() {
finally {
a = null
}
<!DEBUG_INFO_CONSTANT{OI}!>a<!><!UNSAFE_CALL!>.<!>hashCode() // a is null here
a<!UNSAFE_CALL!>.<!>hashCode() // a is null here
}
@@ -3,5 +3,5 @@ fun foo() {
// It is possible in principle to provide smart cast here
v<!UNSAFE_CALL!>.<!>length
v = null
<!DEBUG_INFO_CONSTANT{OI}!>v<!><!UNSAFE_CALL!>.<!>length
v<!UNSAFE_CALL!>.<!>length
}
@@ -11,7 +11,7 @@ operator fun Long?.inc() = this?.let { it + 1 }
fun bar(arg: Long?): Long {
var i = arg
if (i++ == 5L) {
return i<!UNSAFE_CALL!>--<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{OI}, DEBUG_INFO_MISSING_UNRESOLVED{NI}!>+<!> i
return i<!UNSAFE_CALL!>--<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>+<!> i
}
if (i++ == 7L) {
return i++ <!UNSAFE_OPERATOR_CALL!>+<!> <!TYPE_MISMATCH!>i<!>
@@ -1,6 +1,6 @@
class MyClass
operator fun MyClass.inc(): MyClass { <!UNREACHABLE_CODE{OI}!>return<!> null!! }
operator fun MyClass.inc(): MyClass { return null!! }
public fun box() : MyClass? {
var i : MyClass?
@@ -1,6 +1,6 @@
class MyClass
operator fun MyClass.inc(): MyClass { <!UNREACHABLE_CODE{OI}!>return<!> null!! }
operator fun MyClass.inc(): MyClass { return null!! }
public fun box() {
var i : MyClass?
@@ -1,4 +1,3 @@
fun create(): Map<String, String> = null!!
operator fun <K, V> Map<K, V>.iterator(): Iterator<Map.Entry<K, V>> = null!!
@@ -14,7 +13,7 @@ class MyClass {
m = create()
// See KT-7428
for ((k, v) in <!SMARTCAST_IMPOSSIBLE!>m<!>)
res += (<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{NI}!>k<!>.<!DEBUG_INFO_MISSING_UNRESOLVED{NI}!>length<!> <!DEBUG_INFO_MISSING_UNRESOLVED{NI}!>+<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE{NI}!>v<!>.<!DEBUG_INFO_MISSING_UNRESOLVED{NI}!>length<!>)
res += (<!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>k<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!> <!DEBUG_INFO_MISSING_UNRESOLVED!>+<!> <!DEBUG_INFO_ELEMENT_WITH_ERROR_TYPE!>v<!>.<!DEBUG_INFO_MISSING_UNRESOLVED!>length<!>)
return res
}
}
@@ -1,5 +1,5 @@
fun foo(): Int {
var i: Int? = <!VARIABLE_WITH_REDUNDANT_INITIALIZER!>42<!>
i = null
return <!TYPE_MISMATCH!><!DEBUG_INFO_CONSTANT{OI}!>i<!> + 1<!>
return <!TYPE_MISMATCH!>i + 1<!>
}
@@ -1,5 +1,5 @@
fun foo(): Int {
var s: String? = <!VARIABLE_WITH_REDUNDANT_INITIALIZER!>"abc"<!>
s = null
return <!DEBUG_INFO_CONSTANT{OI}!>s<!><!UNSAFE_CALL!>.<!>length
return s<!UNSAFE_CALL!>.<!>length
}