FIR: introduce FirExpressionWithSmartcastToNull

This new kind of expression encompasses the nullability of the original
expression after null check (or equivalent `is Nothing?` check).

Unlike FirExpressionWithSmartcast, this expression won't be materialized
during conversion to backend IR. Also, Nothing? is discarded when
computing the intersection of possible types from smartcast info.
In that way, Nothing? is not used during resolution, while such
smartcast info is stored in it (and the expression kind itself).
This commit is contained in:
Jinseong Jeon
2021-04-29 23:50:22 -07:00
committed by TeamCityServer
parent 8da183e4f4
commit 8e10b5fdec
36 changed files with 370 additions and 104 deletions
@@ -20,11 +20,11 @@ fun <T> T?.case_3(value_1: Int?, value_2: Boolean): Boolean {
// TESTCASE NUMBER: 4
fun case_4(value_1: Number, block: (() -> Unit)?): Boolean? {
<!WRONG_IMPLIES_CONDITION!>contract {
contract {
returns(true) implies (value_1 is Int)
returns(false) implies (block == null)
returns(null) implies (block != null)
}<!>
}
return value_1 == null
}
@@ -87,7 +87,7 @@ fun case_6(x: EmptyClass?) {
// TESTCASE NUMBER: 7
fun case_7() {
if (nullableNumberProperty != null || <!EQUALITY_NOT_APPLICABLE!><!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!> != null is Boolean<!>) {
if (nullableNumberProperty != null || <!EQUALITY_NOT_APPLICABLE!><!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number? & kotlin.Number?")!>nullableNumberProperty<!> != null is Boolean<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!>.propT
@@ -262,8 +262,8 @@ fun case_16() {
// TESTCASE NUMBER: 17
val case_17 = if (nullableIntProperty == null == true == false) 0 else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>nullableIntProperty<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>nullableIntProperty<!>.<!UNRESOLVED_REFERENCE!>java<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>nullableIntProperty<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>nullableIntProperty<!>.<!UNRESOLVED_REFERENCE!>java<!>
}
//TESTCASE NUMBER: 18
@@ -440,18 +440,18 @@ fun case_25(b: Boolean) {
// TESTCASE NUMBER: 26
fun case_26(a: ((Float) -> Int?)?, b: Float?) {
if (a != null == true == false && b != null == true == false) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!><!UNSAFE_IMPLICIT_INVOKE_CALL!>a<!>(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float? & kotlin.Float?")!>b<!>)<!>
if (x != null == true === false) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>propAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.propNullableT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.propNullableAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.funT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>funAny()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.funNullableT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>.funNullableAny()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>.propT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>propAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>.propNullableT
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>.propNullableAny
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>.funT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>funAny()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>.funNullableT()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>.funNullableAny()
}
}
}
@@ -18,8 +18,8 @@ fun case_1(x: ClassWithCustomEquals) {
// TESTCASE NUMBER: 2
fun case_2(x: ClassWithCustomEquals) {
if (x == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
}
@@ -76,8 +76,8 @@ fun case_6(x: ClassWithCustomEquals) {
// TESTCASE NUMBER: 7
fun case_7(x: ClassWithCustomEquals) {
if ((x != null) == false) {
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & ClassWithCustomEquals")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("ClassWithCustomEquals & ClassWithCustomEquals")!>x<!>.<!UNRESOLVED_REFERENCE!>inv<!>()
}
}
@@ -37,8 +37,8 @@ fun case_4(x: Any) {
// TESTCASE NUMBER: 5
fun case_5(x: Any?) {
if (!(x !is Nothing?)) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!><!UNRESOLVED_REFERENCE!>inv<!>()
}
}
@@ -61,16 +61,16 @@ fun case_7(x: Any) {
// TESTCASE NUMBER: 8
fun case_8(x: Any?) {
if (!(x is Nothing?)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>?.<!UNRESOLVED_REFERENCE!>inv<!>()
}
}
// TESTCASE NUMBER: 9
fun case_9(x: Any?) {
if (!!(x !is Nothing?)) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing")!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!>inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!><!UNNECESSARY_SAFE_CALL!>?.<!><!UNRESOLVED_REFERENCE!>inv<!>()
}
}
@@ -85,7 +85,7 @@ fun case_10(x: Any?) {
// TESTCASE NUMBER: 11
fun case_11(x: Any?) {
if (x is Nothing?) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>?.inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>?.<!UNRESOLVED_REFERENCE!>inv<!>()
}
}
@@ -9,8 +9,8 @@ fun case_1(a: Any?) {
if (true) continue
}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>a<!><!UNSAFE_CALL!>.<!>equals(10)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>a<!><!UNSAFE_CALL!>.<!>equals(10)
}
// TESTCASE NUMBER: 2
@@ -12,7 +12,7 @@ fun nullableStringArg(number: String?) {}
*/
fun case_1(x: Int?) {
if (x == null) {
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>)
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>)
}
}
@@ -34,7 +34,7 @@ fun case_2(x: Int?, y: Nothing?) {
*/
fun case_3(x: Int?) {
if (x == null) {
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>)
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>)
}
}
@@ -45,7 +45,7 @@ fun case_3(x: Int?) {
*/
fun case_4(x: Int?) {
if (x == null) {
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>)
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>)
}
}
@@ -57,6 +57,6 @@ fun case_4(x: Int?) {
fun case_5(x: Int?) {
if (x == null) {
var y = x
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>y<!>)
nullableStringArg(<!ARGUMENT_TYPE_MISMATCH, DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>y<!>)
}
}
@@ -15,8 +15,8 @@ fun case_1() {
break@outer
}
}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
}
/*
@@ -32,8 +32,8 @@ fun case_2() {
break@outer
}
}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
}
/*
@@ -145,8 +145,8 @@ fun case_9() {
inner@ do {
x = null
} while (x != null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String? & kotlin.String?")!>x<!><!UNSAFE_CALL!>.<!>length
}
}
@@ -151,8 +151,8 @@ fun case_12() {
while (true) {
y += if (x == null) break else 10
}
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!><!UNSAFE_CALL!>.<!>inv()
}
// TESTCASE NUMBER: 13
@@ -17,5 +17,5 @@ fun case_1(x: Number?): Long? {
* ISSUES: KT-22997
*/
fun case_2(x: Number?): Long? {
if (x == null || x is Long) return <!RETURN_TYPE_MISMATCH!>x<!> else return 0L
if (x == null || x is Long) return x else return 0L
}
@@ -122,7 +122,7 @@ fun case_6(x: EmptyClass?) {
// TESTCASE NUMBER: 7
fun case_7() {
if (nullableNumberProperty != null || <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number?")!>nullableNumberProperty<!> != null) {
if (nullableNumberProperty != null || <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number? & kotlin.Number?")!>nullableNumberProperty<!> != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number? & kotlin.Number")!>nullableNumberProperty<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number? & kotlin.Number")!>nullableNumberProperty<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Number? & kotlin.Number")!>nullableNumberProperty<!>.propT
@@ -288,7 +288,7 @@ fun case_11(b: Boolean) {
if (z != null || b) {
} else {
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!>z<!>
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>? & <anonymous>?")!>z<!>
}
}
}
@@ -16,14 +16,14 @@ import otherpackage.*
// TESTCASE NUMBER: 1
fun case_1(x: Any?) {
if (x == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>
}
}
// TESTCASE NUMBER: 2
fun case_2(x: Nothing?) {
if (x == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>
}
}
@@ -38,7 +38,7 @@ fun case_3() {
// TESTCASE NUMBER: 4
fun case_4(x: Char?) {
if (x == null && true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char? & kotlin.Char?")!>x<!>
}
}
@@ -46,7 +46,7 @@ fun case_4(x: Char?) {
fun case_5() {
val x: Unit? = null
if (x == null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit?")!>x<!>
if (x == null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit? & kotlin.Unit?")!>x<!>
}
// TESTCASE NUMBER: 6
@@ -54,7 +54,7 @@ fun case_6(x: EmptyClass?) {
val y = true
if (x == null && !y) {
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyClass?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyClass? & EmptyClass?")!>x<!>
}
}
@@ -67,8 +67,8 @@ fun case_7() {
// TESTCASE NUMBER: 8
fun case_8(x: TypealiasNullableString) {
if (x == null && <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!> == null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>
if (x == null && <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & TypealiasNullableString")!>x<!> == null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & TypealiasNullableString")!>x<!>
}
/*
@@ -105,7 +105,7 @@ fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) {
if (y == null) {
if (nullableStringProperty != null) {
if (z == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString? & TypealiasNullableString?")!>x<!>
}
}
}
@@ -172,7 +172,7 @@ fun case_14() {
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasNullableString) {
val t = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String?")!>if (x != null) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & TypealiasNullableString")!>x<!>
}<!>
}
@@ -187,13 +187,13 @@ fun case_16() {
// TESTCASE NUMBER: 17
val case_17 = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>if (nullableIntProperty !== null) 0 else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>nullableIntProperty<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>nullableIntProperty<!>
}<!>
//TESTCASE NUMBER: 18
fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?) {
if (a == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J? & DeepObject.A.B.C.D.E.F.G.J?")!>a<!>
}
}
@@ -249,15 +249,15 @@ fun case_21() {
// TESTCASE NUMBER: 22
fun case_22(a: (() -> Unit)?) {
if (a == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit>? & kotlin.Function0<kotlin.Unit>?")!>a<!>
}
}
// TESTCASE NUMBER: 23
fun case_23(a: ((Float) -> Int?)?, b: Float?) {
if (a == null && b == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float?")!>b<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>? & kotlin.Function1<kotlin.Float, kotlin.Int?>?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float? & kotlin.Float?")!>b<!>
if (a != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Float, kotlin.Int?>? & kotlin.Function1<kotlin.Float, kotlin.Int?>")!>a<!>
}
@@ -290,13 +290,13 @@ fun case_25(b: Boolean) {
val z = <!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!>y()<!>
if (z == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>?")!>z<!>
<!DEBUG_INFO_EXPRESSION_TYPE("<anonymous>? & <anonymous>?")!>z<!>
}
}
}
// TESTCASE NUMBER: 26
fun case_26(a: Int?, b: Int? = if (a !== null) 0 else <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>a<!>) {
fun case_26(a: Int?, b: Int? = if (a !== null) 0 else <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>a<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>b<!>
}
@@ -19,14 +19,14 @@ import otherpackage.*
// TESTCASE NUMBER: 1
fun case_1(x: Any) {
if (x === null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Any")!>x<!>
}
}
// TESTCASE NUMBER: 2
fun case_2(x: Nothing) {
if (x == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing & kotlin.Nothing")!>x<!>
}
}
@@ -41,7 +41,7 @@ fun case_3() {
// TESTCASE NUMBER: 4
fun case_4(x: Char) {
if (x == null && true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Char & kotlin.Char")!>x<!>
}
}
@@ -49,7 +49,7 @@ fun case_4(x: Char) {
fun case_5() {
val x: Unit = kotlin.Unit
if (x == null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit")!>x<!>
if (x == null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit & kotlin.Unit")!>x<!>
}
// TESTCASE NUMBER: 6
@@ -57,7 +57,7 @@ fun case_6(x: EmptyClass) {
val y = true
if (x == null && !y) {
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyClass")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyClass & EmptyClass")!>x<!>
}
}
@@ -70,7 +70,7 @@ fun case_7() {
// TESTCASE NUMBER: 8
fun case_8(x: TypealiasString) {
if (x == null && <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString")!>x<!> == null) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString")!>x<!>
if (x == null && <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString & TypealiasString")!>x<!> == null) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString & TypealiasString")!>x<!>
}
// TESTCASE NUMBER: 9
@@ -78,7 +78,7 @@ fun case_9(x: TypealiasString) {
if (x != null) {
} else if (false) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString & TypealiasString")!>x<!>
}
}
@@ -103,7 +103,7 @@ fun case_11(x: TypealiasString, y: TypealiasString) {
if (y == null) {
if (stringProperty != null) {
if (false || false || false || z == null || false) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString & TypealiasString")!>x<!>
}
}
}
@@ -112,14 +112,14 @@ fun case_11(x: TypealiasString, y: TypealiasString) {
// TESTCASE NUMBER: 12
fun case_12(x: TypealiasString, y: TypealiasString) = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.String")!>if (x != null) "1"
else if (y !== null) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString")!>x<!>
else if (y !== null) <!DEBUG_INFO_EXPRESSION_TYPE("TypealiasString & TypealiasString")!>x<!>
else "-1"<!>
// TESTCASE NUMBER: 13
fun case_13(x: otherpackage.EmptyClass13) =
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>if (x != null) {
1
} else <!DEBUG_INFO_EXPRESSION_TYPE("otherpackage.EmptyClass13")!>x<!><!>
} else <!DEBUG_INFO_EXPRESSION_TYPE("otherpackage.EmptyClass13 & otherpackage.EmptyClass13")!>x<!><!>
// TESTCASE NUMBER: 14
class A14 {
@@ -179,7 +179,7 @@ fun case_16() {
val x: TypealiasNothing = return
if (x == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNothing & TypealiasNothing")!>x<!>
}
}
@@ -195,7 +195,7 @@ val case_17 = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>if (true && true && in
//TESTCASE NUMBER: 18
fun case_18(a: DeepObject.A.B.C.D.E.F.G.J) {
if (a == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("DeepObject.A.B.C.D.E.F.G.J & DeepObject.A.B.C.D.E.F.G.J")!>a<!>
}
}
@@ -256,7 +256,7 @@ fun case_22(a: (() -> Unit)) {
// TESTCASE NUMBER: 23
fun case_23(a: ((Float) -> Int), b: Float) {
if (a == null && b == null) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>a(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float")!>b<!>)<!>
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>a(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float & kotlin.Float")!>b<!>)<!>
if (x !== null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>x<!>
}
@@ -276,13 +276,13 @@ fun case_24(a: ((() -> Unit) -> Unit), b: (() -> Unit)) {
}
// TESTCASE NUMBER: 25
fun case_25(a: (() -> Unit) -> Unit, b: (() -> Unit) -> Unit = if (a == null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>")!>a<!> else {{}}) {
fun case_25(a: (() -> Unit) -> Unit, b: (() -> Unit) -> Unit = if (a == null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit> & kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>")!>a<!> else {{}}) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function1<kotlin.Function0<kotlin.Unit>, kotlin.Unit>")!>b<!>
}
// TESTCASE NUMBER: 26
fun case_26(a: Int, b: Int = if (a === null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>a<!> else 0) {
fun case_26(a: Int, b: Int = if (a === null) <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int")!>a<!> else 0) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int")!>b<!>
}
@@ -133,8 +133,8 @@ fun case_13(x: Any?) {
*/
fun case_14(x: Any?) {
if (x == null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>?.equals(10)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>?.equals(10)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x!!<!>.equals(10)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>.equals(10)
}
@@ -147,8 +147,8 @@ fun case_14(x: Any?) {
*/
fun case_15(x: Any?) {
if (x !== null) else {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any?")!>x<!>?.equals(10)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>?.equals(10)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any")!>x!!<!>.equals(10)
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any")!>x<!>.equals(10)
}
@@ -13,8 +13,8 @@ fun case_1(x: Any?) {
// TESTCASE NUMBER: 2
fun case_2(x: Any?) {
(x as Nothing?)!!
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!><!UNSAFE_CALL{LT}!>.<!><!UNRESOLVED_REFERENCE!>inv<!>()
}
// TESTCASE NUMBER: 3
@@ -36,8 +36,8 @@ fun case_4(x: Any?) {
// TESTCASE NUMBER: 5
fun case_5(x: Any?) {
if (x as Nothing? is Nothing) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>inv()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Any?")!>x<!><!UNSAFE_CALL{LT}!>.<!><!UNRESOLVED_REFERENCE!>inv<!>()
}
}
@@ -39,7 +39,7 @@ fun case_1(x: Any?) {
*/
fun case_2(x: Nothing?) {
if (x !== null && x !== null) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Nothing? & kotlin.Nothing?")!>x<!>
}
}
@@ -115,7 +115,7 @@ fun case_6(x: Class?) {
// TESTCASE NUMBER: 7
fun case_7() {
val x: EmptyObject? = null
if (x != null || x != null || <!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject?")!>x<!> != null) {
if (x != null || x != null || <!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject? & EmptyObject?")!>x<!> != null) {
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject? & EmptyObject")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject? & EmptyObject")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("EmptyObject? & EmptyObject")!>x<!>.propT
@@ -25,7 +25,7 @@ fun case_2(): Int? {
val x: Int? = null
return when (x != null) {
false -> {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>
}
else -> null
}
@@ -53,7 +53,7 @@ fun case_4(): Int? {
val x: Int? = null
return when (x == null) {
true -> {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int?")!>x<!>
}
else -> null
}