FIR DFA: smartcast variable to Nothing? on null assignment
In order to make resolution still work for members not available from `Nothing`, we track the type without `Nothing?` and use that for resolution instead.
This commit is contained in:
committed by
teamcityserver
parent
7e2f15f532
commit
4726dcce40
@@ -12,7 +12,7 @@ fun case_1(x: Int?) = x
|
||||
fun case_1() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
case_1(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>)
|
||||
<!OVERLOAD_RESOLUTION_AMBIGUITY!>case_1<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>)
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 2
|
||||
@@ -21,7 +21,7 @@ fun case_2(x: Nothing?) = x
|
||||
fun case_2() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
case_2(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>)
|
||||
case_2(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>)
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 3
|
||||
@@ -29,7 +29,7 @@ fun case_3(x: String?) = x
|
||||
fun case_3() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
case_3(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>)
|
||||
case_3(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>)
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -42,7 +42,7 @@ fun Int?.case_4() = this
|
||||
fun case_4() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.case_4()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.<!OVERLOAD_RESOLUTION_AMBIGUITY!>case_4<!>()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 5
|
||||
@@ -51,7 +51,7 @@ fun Nothing?.case_5() = this
|
||||
fun case_5() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.case_5()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.case_5()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 6
|
||||
@@ -59,7 +59,7 @@ fun String?.case_6() = this
|
||||
fun case_6() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.<!INAPPLICABLE_CANDIDATE!>case_6<!>()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.case_6()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -72,7 +72,7 @@ fun <T : Int?> T.case_7() = this
|
||||
fun case_7() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.case_7()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.<!OVERLOAD_RESOLUTION_AMBIGUITY!>case_7<!>()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 8
|
||||
@@ -81,7 +81,7 @@ fun <T : Nothing?> T.case_8() = this
|
||||
fun case_8() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.case_8()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.case_8()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 9
|
||||
@@ -89,7 +89,7 @@ fun <T : String?> T.case_9() = this
|
||||
fun case_9() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.<!INAPPLICABLE_CANDIDATE!>case_9<!>()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.case_9()
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -102,7 +102,7 @@ fun <T : <!FINAL_UPPER_BOUND!>Int<!>> T?.case_10() = this
|
||||
fun case_10() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.case_10()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.<!OVERLOAD_RESOLUTION_AMBIGUITY!>case_10<!>()
|
||||
}
|
||||
|
||||
// TESTCASE NUMBER: 11
|
||||
@@ -110,5 +110,5 @@ fun <T : <!FINAL_UPPER_BOUND!>String<!>> T?.case_11() = this
|
||||
fun case_11() {
|
||||
var x: Int? = 10
|
||||
x = null
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.<!INAPPLICABLE_CANDIDATE!>case_11<!>()
|
||||
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>.case_11()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user