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