[FIR-TEST] Update testdata of old frontend tests

This commit is contained in:
Dmitriy Novozhilov
2020-01-20 14:48:01 +03:00
parent 19e0b8039b
commit 5f639dd2ae
40 changed files with 59 additions and 59 deletions
@@ -22,7 +22,7 @@ fun f(): Unit {
x === 1 x === 1
x !== 1 x !== 1
x<!UNRESOLVED_REFERENCE!>..<!>2 x..2
x in 1..2 x in 1..2
val y : Boolean? = true val y : Boolean? = true
+1 -1
View File
@@ -24,7 +24,7 @@ fun testWrongIncDec() {
var x = WrongIncDec() var x = WrongIncDec()
x++ x++
<!AMBIGUITY!>++<!>x <!AMBIGUITY!>++<!>x
x<!AMBIGUITY!>--<!> x--
<!AMBIGUITY!>--<!>x <!AMBIGUITY!>--<!>x
} }
+1 -1
View File
@@ -285,7 +285,7 @@ fun f8(b : String?, a : String) {
b?.get(0) b?.get(0)
} }
else { else {
b.<!INAPPLICABLE_CANDIDATE!>get<!>(0) b.get(0)
} }
} }
@@ -10,6 +10,6 @@ fun test(a: Any?, flag: Boolean, x: Any?) {
} }
else { else {
b = x b = x
b.hashCode() b.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
@@ -13,15 +13,15 @@ class B {
fun f() { fun f() {
a = A() a = A()
a.f(true) a.<!INAPPLICABLE_CANDIDATE!>f<!>(true)
takeInt(a.f("")) takeInt(a.<!INAPPLICABLE_CANDIDATE!>f<!>(""))
a.<!INAPPLICABLE_CANDIDATE!>f<!>() a.<!INAPPLICABLE_CANDIDATE!>f<!>()
} }
fun g() { fun g() {
takeInt(if (3 > 2) { takeInt(if (3 > 2) {
a = A() a = A()
a.f(true) a.<!INAPPLICABLE_CANDIDATE!>f<!>(true)
} else { } else {
6 6
}) })
@@ -30,7 +30,7 @@ fun test() {
++platformJ ++platformJ
platformNN++ platformNN++
platformN++ platformN<!INAPPLICABLE_CANDIDATE!>++<!>
platformJ++ platformJ++
1 + platformNN 1 + platformNN
@@ -33,6 +33,6 @@ fun foo(x: B<*>) {
Test.rawB.field = A<String>() Test.rawB.field = A<String>()
val anyA: A<Any> = Test.rawB.field val anyA: A<Any> = Test.rawB.field
Test.rawB.field.consume("") Test.rawB.field.<!INAPPLICABLE_CANDIDATE!>consume<!>("")
val y: Any = Test.rawB.field.produce() val y: Any = Test.rawB.field.<!INAPPLICABLE_CANDIDATE!>produce<!>()
} }
@@ -27,8 +27,8 @@ fun g(a: SomeClass?) {
val c = a as? SomeSubClass val c = a as? SomeSubClass
if (c != null) { if (c != null) {
// 'a' and 'c' can be cast to SomeSubClass // 'a' and 'c' can be cast to SomeSubClass
a.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() a.hashCode()
a.<!UNRESOLVED_REFERENCE!>foo<!> a.foo
(a as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!> (a as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!>
c.hashCode() c.hashCode()
c.foo c.foo
@@ -27,8 +27,8 @@ fun g(a: SomeClass?) {
val c = a as? SomeSubClass val c = a as? SomeSubClass
if (c != null) { if (c != null) {
// 'a' and 'c' can be cast to SomeSubClass // 'a' and 'c' can be cast to SomeSubClass
a.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() a.hashCode()
a.<!UNRESOLVED_REFERENCE!>foo<!> a.foo
(a as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!> (a as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!>
c.hashCode() c.hashCode()
c.foo c.foo
@@ -41,7 +41,7 @@ fun f(a: SomeClass?) {
if (aa as? SomeSubClass != null) { if (aa as? SomeSubClass != null) {
aa = null aa = null
// 'aa' cannot be cast to SomeSubClass // 'aa' cannot be cast to SomeSubClass
aa.<!UNRESOLVED_REFERENCE!>hashCode<!>() aa.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
aa.<!UNRESOLVED_REFERENCE!>foo<!> aa.<!UNRESOLVED_REFERENCE!>foo<!>
(aa as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!> (aa as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!>
(aa as SomeSubClass).foo (aa as SomeSubClass).foo
@@ -59,8 +59,8 @@ fun f(a: SomeClass?) {
val c = aa as? SomeSubClass val c = aa as? SomeSubClass
if (c != null) { if (c != null) {
// 'c' can be cast to SomeSubClass // 'c' can be cast to SomeSubClass
aa.<!UNRESOLVED_REFERENCE!>hashCode<!>() aa.hashCode()
aa.<!UNRESOLVED_REFERENCE!>foo<!> aa.foo
(aa as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!> (aa as? SomeSubClass).<!INAPPLICABLE_CANDIDATE!>foo<!>
c.hashCode() c.hashCode()
c.foo c.foo
@@ -33,7 +33,7 @@ fun foo(x : String?, y : String?) {
} }
else { else {
// Both not null // Both not null
x.<!INAPPLICABLE_CANDIDATE!>length<!> x.length
y.length y.length
} }
} }
@@ -11,7 +11,7 @@ fun foo(x: String?, y: String?, z: String?, w: String?) {
if (x == null || y == null || (x != z && y != z)) if (x == null || y == null || (x != z && y != z))
z.<!INAPPLICABLE_CANDIDATE!>length<!> z.<!INAPPLICABLE_CANDIDATE!>length<!>
else else
z.<!INAPPLICABLE_CANDIDATE!>length<!> z.length
if (x != null && y == x && z == y && w == z) if (x != null && y == x && z == y && w == z)
w.length w.length
else else
@@ -12,7 +12,7 @@ fun printMessages() {
Message.HELLO.text!! Message.HELLO.text!!
Message.HELLO.text.length Message.HELLO.text.length
Message.NOTHING.text.length Message.NOTHING.text.<!INAPPLICABLE_CANDIDATE!>length<!>
Message.NOTHING.text!! Message.NOTHING.text!!
Message.NOTHING.text.length Message.NOTHING.text.length
@@ -12,7 +12,7 @@ fun printMessages() {
Message.HELLO.text!! Message.HELLO.text!!
Message.HELLO.text.length Message.HELLO.text.length
Message.NOTHING.text.length Message.NOTHING.text.<!INAPPLICABLE_CANDIDATE!>length<!>
Message.NOTHING.text!! Message.NOTHING.text!!
Message.NOTHING.text.length Message.NOTHING.text.length
@@ -7,6 +7,6 @@ fun foo() {
var y: My? = My(42) var y: My? = My(42)
if (y!!.x != null) { if (y!!.x != null) {
y = My(null) y = My(null)
y!!.x.hashCode() y!!.x.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
@@ -9,6 +9,6 @@ fun foo() {
var y: My? = My(42) var y: My? = My(42)
if (y!!.x != null) { if (y!!.x != null) {
y = My(null) y = My(null)
(y + My(0)).x.hashCode() (y + My(0)).x.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
@@ -17,14 +17,14 @@ fun foo(arg: Int?) {
var z = arg var z = arg
z = z?.let { 42 } z = z?.let { 42 }
if (z != null) { if (z != null) {
arg.hashCode() arg.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
fun kt6840_1(s: String?) { fun kt6840_1(s: String?) {
val hash = s?.hashCode() val hash = s?.hashCode()
if (hash != null) { if (hash != null) {
s.<!INAPPLICABLE_CANDIDATE!>length<!> s.length
} }
} }
@@ -9,5 +9,5 @@ fun foo(arg: Int?) {
} }
if (x != null) x = 42 if (x != null) x = 42
// Unsafe because of lambda // Unsafe because of lambda
x.<!UNRESOLVED_REFERENCE!>hashCode<!>() x.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
@@ -2,16 +2,16 @@
fun foo(arg: Any?) { fun foo(arg: Any?) {
val x = arg as? Any ?: return val x = arg as? Any ?: return
arg.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() arg.hashCode()
x.hashCode() x.hashCode()
} }
fun bar(arg: Any?) { fun bar(arg: Any?) {
arg as? Any ?: return arg as? Any ?: return
arg.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() arg.hashCode()
} }
fun gav(arg: Any?) { fun gav(arg: Any?) {
arg as? String ?: return arg as? String ?: return
arg.<!UNRESOLVED_REFERENCE!>length<!> arg.length
} }
@@ -7,7 +7,7 @@
fun kt6840_1(s: String?) { fun kt6840_1(s: String?) {
val hash = s?.hashCode() val hash = s?.hashCode()
if (hash != null) { if (hash != null) {
s.<!INAPPLICABLE_CANDIDATE!>length<!> s.length
} }
} }
@@ -42,8 +42,8 @@ fun kt4565_1(a: SomeClass?) {
val data = a?.data val data = a?.data
if (data != null) { if (data != null) {
data.hashCode() data.hashCode()
a.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() a.hashCode()
a.<!INAPPLICABLE_CANDIDATE!>data<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>() a.data.hashCode()
} }
if (a?.data != null) { if (a?.data != null) {
// To be supported (?!) // To be supported (?!)
@@ -52,7 +52,7 @@ fun kt4565_1(a: SomeClass?) {
a.data.hashCode() a.data.hashCode()
} }
if (a?.data is String) { if (a?.data is String) {
a.<!INAPPLICABLE_CANDIDATE!>data<!>.<!UNRESOLVED_REFERENCE!>length<!> a.data.length
data.length data.length
} }
} }
@@ -5,7 +5,7 @@ class A(val x: String?) {
fun foo(other: A) { fun foo(other: A) {
when { when {
x == null && other.x == null -> "1" x == null && other.x == null -> "1"
x.length > 0 -> "2" x.<!INAPPLICABLE_CANDIDATE!>length<!> > 0 -> "2"
} }
} }
} }
@@ -6,6 +6,6 @@ public fun foo() {
var s: Any = "not null" var s: Any = "not null"
if (s is String) { if (s is String) {
s = 42 s = 42
bar(s) <!INAPPLICABLE_CANDIDATE!>bar<!>(s)
} }
} }
@@ -13,5 +13,5 @@ fun list(start: String) {
e = e.next() e = e.next()
} }
// e can never be null but we do not know it // e can never be null but we do not know it
e.hashCode() e.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
@@ -7,5 +7,5 @@ fun foo() {
v = null v = null
v.<!UNRESOLVED_REFERENCE!>length<!> v.<!UNRESOLVED_REFERENCE!>length<!>
v = "abc" v = "abc"
v.<!UNRESOLVED_REFERENCE!>length<!> v.length
} }
@@ -15,6 +15,6 @@ fun foo(arg: Int?) {
var z = arg var z = arg
z = z?.let { 42 } z = z?.let { 42 }
if (z != null) { if (z != null) {
arg.hashCode() arg.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
@@ -23,7 +23,7 @@ fun bar(s: String?) {
val hashCode = ss?.hashCode() val hashCode = ss?.hashCode()
ss = null ss = null
if (hashCode != null) { if (hashCode != null) {
ss.<!UNRESOLVED_REFERENCE!>hashCode<!>() ss.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
@@ -31,7 +31,7 @@ fun bar2(s: String?) {
var ss = s var ss = s
val hashCode = ss?.hashCode() val hashCode = ss?.hashCode()
if (hashCode != null) { if (hashCode != null) {
ss.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() ss.hashCode()
} }
} }
@@ -40,7 +40,7 @@ class Some(var s: String?)
fun baz(arg: Some?) { fun baz(arg: Some?) {
val ss = arg?.s val ss = arg?.s
if (ss != null) { if (ss != null) {
arg.<!INAPPLICABLE_CANDIDATE!>hashCode<!>() arg.hashCode()
arg.<!INAPPLICABLE_CANDIDATE!>s<!>.<!UNRESOLVED_REFERENCE!>hashCode<!>() arg.s.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
@@ -44,7 +44,7 @@ fun gaz(s: String?) {
x = null x = null
} }
run { run {
x.hashCode() x.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
} }
} }
@@ -11,11 +11,11 @@ fun list(start: SomeObject) {
// In theory smart cast is possible here // In theory smart cast is possible here
// But in practice we have a loop with changing e // But in practice we have a loop with changing e
// ?: should we "or" entrance type info with condition type info? // ?: should we "or" entrance type info with condition type info?
if (!e.doSomething()) if (<!UNRESOLVED_REFERENCE!>!<!>e.<!INAPPLICABLE_CANDIDATE!>doSomething<!>())
break break
// Smart cast here is still not possible // Smart cast here is still not possible
e = e.next() e = e.<!INAPPLICABLE_CANDIDATE!>next<!>()
} while (e != null) } while (e != null)
// e can be null because of next() // e can be null because of next()
e.doSomething() e.<!INAPPLICABLE_CANDIDATE!>doSomething<!>()
} }
@@ -8,5 +8,5 @@ public fun foo(pp: String?): Int {
p = null p = null
} while (!x()) } while (!x())
// Smart cast is NOT possible here // Smart cast is NOT possible here
return p.length return p.<!INAPPLICABLE_CANDIDATE!>length<!>
} }
@@ -16,5 +16,5 @@ fun list(start: SomeObject) {
e = e.next() e = e.next()
} }
// e can be null because of next() // e can be null because of next()
e.doSomething() e.<!INAPPLICABLE_CANDIDATE!>doSomething<!>()
} }
@@ -9,5 +9,5 @@ public fun box() {
// type of j should be MyClass? // type of j should be MyClass?
var j = ++i var j = ++i
// j is null so call should be unsafe // j is null so call should be unsafe
j.hashCode() j.<!INAPPLICABLE_CANDIDATE!>hashCode<!>()
} }
@@ -10,5 +10,5 @@ fun foo() {
} catch (ex: Exception) {} } catch (ex: Exception) {}
bar(s) bar(s)
if (s != null) { } if (s != null) { }
s.<!UNRESOLVED_REFERENCE!>hashCode<!>() s.hashCode()
} }
@@ -13,8 +13,8 @@ class MyClass {
var res = 0 var res = 0
m = create() m = create()
// See KT-7428 // See KT-7428
for ((k, v) in m) <!INAPPLICABLE_CANDIDATE, UNRESOLVED_REFERENCE, UNRESOLVED_REFERENCE!>for ((k, v) in m)
res += (k.length + v.length) <!UNRESOLVED_REFERENCE!>res += (k.<!UNRESOLVED_REFERENCE!>length<!> + v.<!UNRESOLVED_REFERENCE!>length<!>)<!><!>
return res return res
} }
} }
@@ -9,5 +9,5 @@ public fun foo(pp: String?): Int {
} }
// Smart cast is NOT possible here // Smart cast is NOT possible here
// (we could provide it but p = null makes it much harder) // (we could provide it but p = null makes it much harder)
return p.length return p.<!INAPPLICABLE_CANDIDATE!>length<!>
} }
@@ -9,5 +9,5 @@ public fun foo(pp: String?): Int {
} }
// Smart cast is NOT possible here // Smart cast is NOT possible here
// (we could provide it but p = null makes it much harder) // (we could provide it but p = null makes it much harder)
return p.length return p.<!INAPPLICABLE_CANDIDATE!>length<!>
} }
@@ -9,5 +9,5 @@ public fun foo(pp: String?): Int {
} }
// Smart cast is NOT possible here // Smart cast is NOT possible here
// (we could provide it but p = null makes it much harder) // (we could provide it but p = null makes it much harder)
return p.length return p.<!INAPPLICABLE_CANDIDATE!>length<!>
} }
@@ -13,5 +13,5 @@ fun list(start: SomeObject) {
e = e.next() e = e.next()
} }
// e can be null because of next() // e can be null because of next()
e.doSomething() e.<!INAPPLICABLE_CANDIDATE!>doSomething<!>()
} }
@@ -3,5 +3,5 @@
fun foo(y: String) { fun foo(y: String) {
var x: String? = null var x: String? = null
y.let { x = it } y.let { x = it }
x.length // Smart cast is not possible x.<!INAPPLICABLE_CANDIDATE!>length<!> // Smart cast is not possible
} }
@@ -30,7 +30,7 @@ fun test2(s: String?) {
requireNotNull(s) requireNotNull(s)
t2 = true t2 = true
} }
t2.<!UNRESOLVED_REFERENCE!>not<!>() t2.not()
s.length s.length
} }
} }
@@ -31,7 +31,7 @@ fun test2(s: String?) {
requireNotNull(s) requireNotNull(s)
t2 = true t2 = true
} }
t2.<!UNRESOLVED_REFERENCE!>not<!>() t2.not()
s.length s.length
} }
} }