[FIR] Make type of safe call always nullable

^KT-46860 In Progress
This commit is contained in:
Dmitriy Novozhilov
2021-06-21 17:34:21 +03:00
committed by teamcityserver
parent f18e38a49f
commit 09994ee8ea
9 changed files with 18 additions and 14 deletions
@@ -8,13 +8,13 @@ interface A {
fun takeInt(x: Int) {}
fun test_1(a: A) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>a<!UNNECESSARY_SAFE_CALL!>?.<!>foo()<!>
takeInt(x) // should be an error
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>a<!UNNECESSARY_SAFE_CALL!>?.<!>foo()<!>
takeInt(<!ARGUMENT_TYPE_MISMATCH!>x<!>) // should be an error
}
fun test_2(a: A?) {
if (a != null) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>a<!UNNECESSARY_SAFE_CALL!>?.<!>foo()<!>
takeInt(x) // should be an error
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>a<!UNNECESSARY_SAFE_CALL!>?.<!>foo()<!>
takeInt(<!ARGUMENT_TYPE_MISMATCH!>x<!>) // should be an error
}
}