[FIR] Enhance equality smartcasting test case to include data classes

^KT-58169 Fixed
This commit is contained in:
Brian Norman
2024-02-02 08:14:16 -06:00
committed by Space Team
parent dd9f702516
commit 1f904aef55
10 changed files with 232 additions and 80 deletions
+2 -28
View File
@@ -1,3 +1,5 @@
// SKIP_TXT
fun foo(x: String?) = x
class Test
@@ -23,31 +25,3 @@ fun gav(i: TestWithEquals?, j: TestWithEquals?) {
if (i == <!DEBUG_INFO_CONSTANT!>j<!>) foo(<!DEBUG_INFO_CONSTANT!>i<!>)
}
}
fun string(foo: Any) {
val string = ""
if ("" == foo) <!DEBUG_INFO_SMARTCAST!>foo<!>.length
if (string == foo) <!DEBUG_INFO_SMARTCAST!>foo<!>.length
if (foo == "") foo.<!UNRESOLVED_REFERENCE!>length<!>
}
fun int(foo: Any) {
val int = 1
if (1 == foo) foo.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>plus<!>(1)
if (int == foo) foo.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>plus<!>(1)
if (foo == 1) foo.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>plus<!>(1)
}
fun long(foo: Any) {
val long = 1L
if (1L == foo) foo.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>plus<!>(1L)
if (long == foo) foo.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>plus<!>(1L)
if (foo == 1L) foo.<!UNRESOLVED_REFERENCE_WRONG_RECEIVER!>plus<!>(1L)
}
fun char(foo: Any) {
val char = 'a'
if ('a' == foo) foo.<!UNRESOLVED_REFERENCE!>compareTo<!>('a')
if (char == foo) foo.<!UNRESOLVED_REFERENCE!>compareTo<!>('a')
if (foo == 'a') foo.<!UNRESOLVED_REFERENCE!>compareTo<!>('a')
}