[FE 1.0] Make type of safe call always nullable
^KT-46860 In Progress
This commit is contained in:
committed by
teamcityserver
parent
805fad980f
commit
26b9948e5f
+20
@@ -0,0 +1,20 @@
|
||||
// LANGUAGE: +SafeCallsAreAlwaysNullable
|
||||
// ISSUE: KT-46860
|
||||
|
||||
interface A {
|
||||
fun foo(): Int
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user