diff --git a/compiler/tests-spec/build.gradle.kts b/compiler/tests-spec/build.gradle.kts index 5f860aa46f3..0ac0bdc7da9 100644 --- a/compiler/tests-spec/build.gradle.kts +++ b/compiler/tests-spec/build.gradle.kts @@ -30,7 +30,7 @@ val remoteRunTests by task { "checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Contracts*", "checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Annotations*", "checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Local_variables\$Type_parameters*", - "checkers.DiagnosticsTestSpecGenerated\$Linked\$Type_inference*", + "checkers.DiagnosticsTestSpecGenerated\$NotLinked\$Dfa*", "codegen.BlackBoxCodegenTestSpecGenerated\$NotLinked\$Annotations\$Type_annotations*", "codegen.BlackBoxCodegenTestSpecGenerated\$NotLinked\$Objects\$Inheritance*" ) diff --git a/compiler/tests-spec/testData/diagnostics/helpers/annotations.kt b/compiler/tests-spec/testData/diagnostics/helpers/annotations.kt new file mode 100644 index 00000000000..1bbffdad43d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/helpers/annotations.kt @@ -0,0 +1,3 @@ +@Retention(AnnotationRetention.SOURCE) +@Target(AnnotationTarget.EXPRESSION) +annotation class RetentionSourceAndTargetExpression \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/helpers/classes.kt b/compiler/tests-spec/testData/diagnostics/helpers/classes.kt index e228e183569..3c64437e16b 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/classes.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/classes.kt @@ -5,12 +5,28 @@ class Class { val prop_4: Float? = 3f val prop_5: Float = 3f val prop_6: String = "..." - val prop_7: Nothing? = "..." + val prop_7: Nothing? = null + val prop_8: Class? = null + var prop_9: Boolean = true + val prop_10: Number? = 3f + val prop_11: Int = 10 + var prop_12: String = "" + val prop_13: Any? = "" + val prop_14: Comparable<*>? = "" + val prop_15: Iterable<*>? = "" fun fun_1(): (Int) -> (Int) -> Int = {number: Int -> { number * 5 }} fun fun_2(value_1: Int): Int = value_1 * 2 fun fun_3(value_1: Int): (Int) -> Int = fun(value_2: Int): Int = value_1 * value_2 * 2 + fun fun_4(): Class? = Class() + operator fun get(i1: Int, i2: Int) = 10 + operator fun set(i1: Int, i2: Int, el: Int) {} + operator fun get(i1: Int) = 10 + operator fun set(i1: Int, el: Int) {} + operator fun invoke() {} + operator fun invoke(x) = { x: Any -> x } + operator fun invoke(x: Any, y: Any) {} operator fun contains(a: Int) = a > 30 operator fun contains(a: Long) = a > 30L operator fun contains(a: Char) = a > 30.toChar() @@ -19,12 +35,24 @@ class Class { fun getLongArray() = longArrayOf(1L, 2L, 3L, 4L, 5L) fun getCharArray() = charArrayOf(1.toChar(), 2.toChar(), 3.toChar(), 4.toChar(), 5.toChar()) - class _NestedClass { + class NestedClass { val prop_4 = 4 val prop_5 = 5 } } +operator fun Class?.inc(): Class? = null +operator fun Class?.dec(): Class? = null +operator fun Class?.plus(x: Class?): Class? = null +operator fun Class?.minus(x: Class?): Class? = null + +open class ClassWithCustomEquals { + override fun equals(other: Any?) = true +} + +open class ClassWithCostructorParam(val x: Any) +open class ClassWithCostructorTwoParams(val x: Any, val y: Any) + class EmptyClass {} class ClassWithCompanionObject { @@ -37,6 +65,15 @@ open class ClassLevel1 { open class ClassLevel2: ClassLevel1() { fun test2() {} } +open class ClassLevel21: ClassLevel1() { + fun test21() {} +} +open class ClassLevel22: ClassLevel1() { + fun test22() {} +} +open class ClassLevel23: ClassLevel1() { + fun test23() {} +} open class ClassLevel3: ClassLevel2() { fun test3() {} } @@ -51,6 +88,11 @@ class ClassLevel6: ClassLevel5() { } class Inv(val x: T = null as T) { + val prop_1: Inv? = null + val prop_2: T? = null + val prop_3: T = null + val prop_4 = 10 + fun test() {} fun get() = x fun put(x: T) {} @@ -63,6 +105,9 @@ class In() { } class Out(val x: T = null as T) { + val prop_1: Inv? = null + val prop_2: T? = null + fun get() = x } @@ -71,10 +116,17 @@ open class ClassWithTwoTypeParameters { fun test2(): K? { return null } } -class ClassWithThreeTypeParameters( +open class ClassWithThreeTypeParameters( val x: K, val y: L, val z: M ) -class ClassWithSixTypeParameters +open class ClassWithSixTypeParameters( + val u: R, + val x: K, + val y: M, + val z: O +) { + fun test() = 10 +} diff --git a/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt b/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt index 27628baf300..47044df6ece 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/enumClasses.kt @@ -1,5 +1,7 @@ enum class EnumClass { - NORTH, SOUTH, WEST, EAST + NORTH, SOUTH, WEST, EAST; + + fun fun_1() {} } enum class EnumClassSingle { diff --git a/compiler/tests-spec/testData/diagnostics/helpers/functions.kt b/compiler/tests-spec/testData/diagnostics/helpers/functions.kt index d2723375730..2684cc96ad6 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/functions.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/functions.kt @@ -17,3 +17,12 @@ fun expandInWithRemoveNullable(vararg x: In): K = x[0] as K fun expandOutWithRemoveNullable(vararg x: Out): K = x[0] as K fun removeNullable(vararg x: K?): K = x as K + +fun T.funT() = 10 +fun T?.funNullableT = 10 + +fun Any.funAny() = 10 +fun Any?.funNullableAny = 10 + + +fun funNothingQuest() = null \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/helpers/interfaces.kt b/compiler/tests-spec/testData/diagnostics/helpers/interfaces.kt index 3caf7fc98b4..28c8c679594 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/interfaces.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/interfaces.kt @@ -3,11 +3,21 @@ interface EmptyInterface interface Interface1 { fun itest() {} fun itest1() {} + fun itest0(): String + fun itest00(): Interface1 + fun itest000(): Int? + fun itest0000(): Int + fun itest00000(): Int } interface Interface2 { fun itest() {} fun itest2() {} + fun itest0(): CharSequence + fun itest00(): Interface2 + fun itest000(): Nothing? + fun itest0000(): Nothing + fun itest00000(): String } interface Interface3 { diff --git a/compiler/tests-spec/testData/diagnostics/helpers/objects.kt b/compiler/tests-spec/testData/diagnostics/helpers/objects.kt index 8dfc914af5a..29a0d4d9c33 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/objects.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/objects.kt @@ -17,6 +17,7 @@ object DeepObject { object G { object J { val x: Int? = 10 + val prop_1: Int? = 10 } } } diff --git a/compiler/tests-spec/testData/diagnostics/helpers/properties.kt b/compiler/tests-spec/testData/diagnostics/helpers/properties.kt index 9c670c2b14d..fc18a9b1e50 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/properties.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/properties.kt @@ -14,3 +14,17 @@ val anonymousTypeProperty = object {} val nullableAnonymousTypeProperty = if (true) object {} else null val nullableOut: Out? = null + +val T.propT get() = 10 + +val T.propDefNotNullT get() = 10 + +val T?.propNullableT get(): Int? = 10 + +val T.propTT get() = 10 as T + +val T?.propNullableTT get() = 10 as T? + +val Any.propAny get() = 10 + +val Any?.propNullableAny get() = 10 \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt b/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt index b692c13e582..7a01ff9c468 100644 --- a/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt +++ b/compiler/tests-spec/testData/diagnostics/helpers/sealedClasses.kt @@ -27,10 +27,12 @@ class SealedWithMethodsChild3() : SealedClassWithMethods() { fun m3() = this.hashCode().toString() } -sealed class SealedClassMixed +sealed class SealedClassMixed { + val prop_1: Int? = 10 +} data class SealedMixedChild1(val number: Int) : SealedClassMixed() data class SealedMixedChild2(val e1: Int, val e2: Int) : SealedClassMixed() data class SealedMixedChild3(val m1: Int, val m2: Int) : SealedClassMixed() -object SealedMixedChildObject1 : SealedClassMixed() +object SealedMixedChildObject1 : SealedClassMixed() { val prop_2: Int? = 10 } object SealedMixedChildObject2 : SealedClassMixed() object SealedMixedChildObject3 : SealedClassMixed() \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.1.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.1.kt deleted file mode 100644 index 7f90e659cfa..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.1.kt +++ /dev/null @@ -1,1166 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 1 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) using if expression and simple types. - * HELPERS: classes, objects, typealiases, properties, enumClasses - */ - -// FILE: other_package.kt - -package otherpackage - -// TESTCASE NUMBER: 13 -class Case13 {} - -// TESTCASE NUMBER: 14 -typealias Case14 = String? - -// FILE: main.kt - -import otherpackage.* - -// TESTCASE NUMBER: 1 -fun case_1(x: Any?) { - if (x != null) { - x - x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 2 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28159 - */ -fun case_2(x: Nothing?) { - if (x !== null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 3 -fun case_3() { - if (Object.prop_1 == null) - else { - Object.prop_1 - Object.prop_1.equals(Object.prop_1) - } -} - -// TESTCASE NUMBER: 4 -fun case_4(x: Char?) { - if (x != null && true) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 5 -fun case_5() { - val x: Unit? = null - - if (x !== null) x - if (x !== null) x.equals(x) -} - -// TESTCASE NUMBER: 6 -fun case_6(x: EmptyClass?) { - val y = true - - if (x != null && !y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 7 -fun case_7() { - if (nullableNumberProperty != null || nullableNumberProperty != null) { - nullableNumberProperty - nullableNumberProperty.equals(nullableNumberProperty) - } -} - -// TESTCASE NUMBER: 8 -fun case_8(x: TypealiasNullableString) { - if (x !== null && x != null) x - if (x !== null && x != null) x.equals(x) -} - -// TESTCASE NUMBER: 9 -fun case_9(x: TypealiasNullableString?) { - if (x === null) { - - } else if (false) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 10 -fun case_10() { - val a = Class() - - if (a.prop_4 === null || true) { - if (a.prop_4 != null) { - a.prop_4 - a.prop_4.equals(a.prop_4) - } - } -} - -// TESTCASE NUMBER: 11 -fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndirect) { - val t: TypealiasNullableStringIndirect = null - - if (x == null) { - - } else { - if (y != null) { - if (nullableStringProperty == null) { - if (t != null) { - x - x.equals(x) - } - } - } - } -} - -// TESTCASE NUMBER: 12 -fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndirect) = - & java.io.Serializable}")!>if (x == null) "1" -else if (y === null) x -else if (y === null) x.equals(x) -else "-1" - -// TESTCASE NUMBER: 13 -fun case_13(x: otherpackage.Case13?) = -if (x == null) { - throw Exception() -} else { - x - x.equals(x) -} - -// TESTCASE NUMBER: 14 -class Case14 { - val x: otherpackage.Case14? - init { - x = otherpackage.Case14() - } -} - -fun case_14() { - val a = Case14() - - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x !== null) { - a.x - a.x.equals(a.x) - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} - -// TESTCASE NUMBER: 15 -fun case_15(x: EmptyObject) { - val t = & java.io.Serializable}")!>if (x === null) "" else { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 16 -fun case_16() { - val x: TypealiasNullableNothing = null - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 17 -val case_17 = & java.io.Serializable}")!>if (nullableIntProperty == null) 0 else { - nullableIntProperty - nullableIntProperty.equals(nullableIntProperty) -} - -//TESTCASE NUMBER: 18 -fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?) { - if (a != null) { - a - a.equals(a) - } -} - -// TESTCASE NUMBER: 19 -fun case_19(b: Boolean) { - val a = if (b) { - object { - val B19 = if (b) { - object { - val C19 = if (b) { - object { - val D19 = if (b) { - object { - val x: Number? = 10 - } - } else null - } - } else null - } - } else null - } - } else null - - if (a != null && a.B19 != null && a.B19.C19 != null && a.B19.C19.D19 != null && a.B19.C19.D19.x != null) { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(null) - } -} - -// TESTCASE NUMBER: 20 -fun case_20(b: Boolean) { - val a = object { - val B19 = object { - val C19 = object { - val D19 = if (b) { - object {} - } else null - } - } - } - - if (a.B19.C19.D19 !== null) { - .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19 - .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.equals(a.B19.C19.D19) - } -} - -// TESTCASE NUMBER: 21 -fun case_21() { - if (EnumClassWithNullableProperty.B.prop_1 !== null) { - EnumClassWithNullableProperty.B.prop_1 - EnumClassWithNullableProperty.B.prop_1.equals(EnumClassWithNullableProperty.B.prop_1) - } -} - -// TESTCASE NUMBER: 22 -fun case_22(a: (() -> Unit)?) { - if (a != null) { - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a() - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().equals(a) - } -} - -// TESTCASE NUMBER: 23 -fun case_23(a: ((Float) -> Int?)?, b: Float?) { - if (a != null && b !== null) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (x != null) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 24 -fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = - if (a !== null && b !== null) { - kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a( kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b) - kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a(b) - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.equals(null) - } else null - -// TESTCASE NUMBER: 25 -fun case_25(b: Boolean) { - val x = { - if (b) object { - val a = 10 - } else null - } - - val y = if (b) x else null - - if (y !== null) { - val z = .?")!> case_25..?)? & () -> case_25..?"), DEBUG_INFO_SMARTCAST!>y() - - if (z != null) { - . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a - . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.equals(z.a) - } - } -} - -// TESTCASE NUMBER: 26 -fun case_26(a: ((Float) -> Int?)?, b: Float?) { - if (a != null == true && b != null == true) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (x != null == true) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 27 -fun case_27() { - if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true) - else { - Object.prop_1 - Object.prop_1.equals(Object.prop_1) - } -} - -//TESTCASE NUMBER: 28 -fun case_28(a: DeepObject.A.B.C.D.E.F.G.J?) = - if (a != null == true == false == false == false == true == false == true == false == false == true == true) { - a.x - a.equals(a) - } else -1 - -// TESTCASE NUMBER: 29 -open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: String?, internal val e: Char?, public val f: Any?) { - val x: Char? = '.' - private val y: Unit? = kotlin.Unit - protected val z: Int? = 12 - public val u: String? = "..." - val s: Any? - val v: Int? - val w: Number? - val t: String? = if (u != null) this.u else null - - init { - if (a != null) a.equals(a) - if (a != null) a - - if (b != null) b.equals(b) - if (b != null) b - if (this.b != null) this.b - if (this.b != null) this.b.equals(this.b) - if (this.b != null) b - if (this.b != null) b.equals(b) - if (b != null) this.b - if (b != null) this.b.equals(b) - if (b != null || this.b != null) b.equals(b) - if (b != null || this.b != null) b - if (b != null || this.b != null) this.b.equals(this.b) - if (b != null || this.b != null) this.b - - if (c != null) c.equals(c) - if (c != null) c - if (this.c != null) this.c.equals(c) - if (this.c != null) this.c - if (c != null) this.c.equals(this.c) - if (c != null) this.c - if (this.c != null) c.equals(this.c) - if (this.c != null) c - if (c != null || this.c != null) c.equals(c) - if (c != null || this.c != null) c - if (c != null || this.c != null) this.c.equals(this.c) - if (c != null || this.c != null) this.c - - if (d != null) d.equals(d) - if (d != null) d - if (this.d != null) this.d.equals(d) - if (this.d != null) this.d - if (d != null) this.d.equals(d) - if (d != null) this.d - if (this.d != null) d.equals(d) - if (this.d != null) d - if (d != null || this.d != null) d.equals(d) - if (d != null || this.d != null) d - if (d != null || this.d != null) this.d.equals(d) - if (d != null || this.d != null) this.d - - if (e != null) e.equals(e) - if (e != null) e - if (this.e != null) this.e.equals(e) - if (this.e != null) this.e - if (this.e != null) e.equals(e) - if (this.e != null) e - if (e != null) this.e.equals(e) - if (e != null) this.e - if (e != null || this.e != null) e.equals(e) - if (e != null || this.e != null) e - if (e != null || this.e != null) this.e.equals(e) - if (e != null || this.e != null) this.e - - if (f != null) f.equals(f) - if (f != null) f - if (this.f != null) this.f.equals(f) - if (this.f != null) this.f - if (this.f != null) f.equals(f) - if (this.f != null) f - if (f != null) this.f.equals(f) - if (f != null) this.f - if (f != null || this.f != null) f.equals(f) - if (f != null || this.f != null) f - if (f != null || this.f != null) this.f.equals(f) - if (f != null || this.f != null) this.f - - if (x != null) x.equals(x) - if (x != null) x - if (this.x != null) this.x.equals(x) - if (this.x != null) this.x - if (x != null) this.x.equals(x) - if (x != null) this.x - if (this.x != null) x.equals(x) - if (this.x != null) x - if (x != null || this.x != null) x.equals(x) - if (x != null || this.x != null) x - if (x != null || this.x != null) this.x.equals(x) - if (x != null || this.x != null) this.x - - if (y != null) y.equals(y) - if (y != null) y - if (this.y != null) this.y.equals(y) - if (this.y != null) this.y - if (this.y != null) y.equals(y) - if (this.y != null) y - if (y != null) this.y.equals(y) - if (y != null) this.y - if (y != null || this.y != null) y.equals(y) - if (y != null || this.y != null) y - if (y != null || this.y != null) this.y.equals(y) - if (y != null || this.y != null) this.y - - if (z != null) z.equals(z) - if (z != null) z - if (this.z != null) this.z.equals(z) - if (this.z != null) this.z - if (z != null) this.z.equals(z) - if (z != null) this.z - if (this.z != null) z.equals(z) - if (this.z != null) z - if (z != null || this.z != null) z - if (z != null || this.z != null) z.equals(z) - if (z != null || this.z != null) this.z - if (z != null || this.z != null) this.z.equals(z) - - if (u != null) u.equals(u) - if (u != null) u - if (this.u != null) this.u.equals(u) - if (this.u != null) this.u - if (this.u != null) u.equals(u) - if (this.u != null) u - if (u != null) this.u.equals(u) - if (u != null) this.u - if (u != null || this.u != null) u.equals(u) - if (u != null || this.u != null) u - if (u != null || this.u != null) this.u.equals(u) - if (u != null || this.u != null) this.u - - v = 0 - v.equals(v) - v - if (v != null) v.equals(v) - if (v != null) v - if (this.v != null) v.equals(v) - if (this.v != null) v - if (v != null || this.v != null) v.equals(v) - if (v != null || this.v != null) v - if (v != null || this.v != null) this.v.equals(v) - if (v != null || this.v != null) this.v - - w = if (null != null) 10 else null - w - if (w != null) w.equals(w) - if (w != null) w - if (this.w != null) w.equals(w) - if (this.w != null) w - if (w != null || this.w != null) w.equals(w) - if (w != null || this.w != null) w - if (w != null || this.w != null) this.w.equals(w) - if (w != null || this.w != null) this.w - - s = null - s.equals(s) - s - if (s != null) s.equals(s) - if (s != null) s - if (this.s != null) s.equals(s) - if (this.s != null) s - if (s != null || this.s != null) s.equals(s) - if (s != null || this.s != null) s - if (s != null || this.s != null) this.s.equals(s) - if (s != null || this.s != null) this.s - } - - fun test() { - if (b != null) b.equals(b) - if (b != null) b - - if (c != null) c.equals(c) - if (c != null) c - - if (d != null) d.equals(d) - if (d != null) d - - if (e != null) e.equals(e) - if (e != null) e - - if (f != null) f.equals(f) - if (f != null) f - - if (x != null) x.equals(x) - if (x != null) x - - if (y != null) y.equals(y) - if (y != null) y - - if (z != null) z.equals(z) - if (z != null) z - - if (u != null) u.equals(u) - if (u != null) u - - if (v != null) v.equals(v) - if (v != null) v - - if (w != null) w.equals(w) - if (w != null) w - - if (s != null) s.equals(s) - if (s != null) s - } -} - -fun case_29(a: Case29) { - if (a.x !== null) a.x.equals(a.x) - if (a.x !== null) a.x - if (a.b !== null) a.b.equals(a.b) - if (a.b !== null) a.b - if (a.e !== null) a.e.equals(a.e) - if (a.e !== null) a.e - if (a.f !== null) a.f.equals(a.f) - if (a.f !== null) a.f - if (a.v != null) a.v.equals(a.v) - if (a.v != null) a.v - if (a.w != null) a.w.equals(a.w) - if (a.w != null) a.w - if (a.s != null) a.s.equals(a.s) - if (a.s != null) a.s -} - -// TESTCASE NUMBER: 30 -sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val d: String?, internal val e: Char?, public val f: Any?) { - val x: Char? = '.' - private val y: Unit? = kotlin.Unit - protected val z: Int? = 12 - public val u: String? = "..." - val s: Any? - val v: Int? - val w: Number? - val t: String? = if (u != null) this.u else null - - init { - if (a != null) a.equals(a) - if (a != null) a - - if (b != null) b.equals(b) - if (b != null) b - if (this.b != null) this.b.equals(this.b) - if (this.b != null) this.b - if (this.b != null) b.equals(b) - if (this.b != null) b - if (b != null) this.b.equals(this.b) - if (b != null) this.b - if (b != null || this.b != null) b.equals(b) - if (b != null || this.b != null) b - if (b != null || this.b != null) this.b.equals(this.b) - if (b != null || this.b != null) this.b - - if (c != null) c.equals(c) - if (c != null) c - if (this.c != null) this.c.equals(this.c) - if (this.c != null) this.c - if (c != null) this.c.equals(this.c) - if (c != null) this.c - if (this.c != null) c.equals(c) - if (this.c != null) c - if (c != null || this.c != null) c.equals(c) - if (c != null || this.c != null) c - if (c != null || this.c != null) this.c.equals(this.c) - if (c != null || this.c != null) this.c - - if (d != null) d.equals(d) - if (d != null) d - if (this.d != null) this.d.equals(this.d) - if (this.d != null) this.d - if (d != null) this.d.equals(this.d) - if (d != null) this.d - if (this.d != null) d.equals(d) - if (this.d != null) d - if (d != null || this.d != null) d.equals(d) - if (d != null || this.d != null) d - if (d != null || this.d != null) this.d.equals(this.d) - if (d != null || this.d != null) this.d - - if (e != null) e.equals(e) - if (e != null) e - if (this.e != null) this.e.equals(this.e) - if (this.e != null) this.e - if (this.e != null) e.equals(e) - if (this.e != null) e - if (e != null) this.e.equals(this.e) - if (e != null) this.e - if (e != null || this.e != null) e.equals(e) - if (e != null || this.e != null) e - if (e != null || this.e != null) this.e.equals(this.e) - if (e != null || this.e != null) this.e - - if (f != null) f.equals(f) - if (f != null) f - if (this.f != null) this.f.equals(this.f) - if (this.f != null) this.f - if (this.f != null) f.equals(f) - if (this.f != null) f - if (f != null) this.f.equals(this.f) - if (f != null) this.f - if (f != null || this.f != null) f.equals(f) - if (f != null || this.f != null) f - if (f != null || this.f != null) this.f.equals(this.f) - if (f != null || this.f != null) this.f - - if (x != null) x.equals(x) - if (x != null) x - if (this.x != null) this.x.equals(this.x) - if (this.x != null) this.x - if (x != null) this.x.equals(this.x) - if (x != null) this.x - if (this.x != null) x.equals(x) - if (this.x != null) x - if (x != null || this.x != null) x.equals(x) - if (x != null || this.x != null) x - if (x != null || this.x != null) this.x.equals(this.x) - if (x != null || this.x != null) this.x - - if (y != null) y.equals(y) - if (y != null) y - if (this.y != null) this.y.equals(this.y) - if (this.y != null) this.y - if (this.y != null) y.equals(y) - if (this.y != null) y - if (y != null) this.y.equals(this.y) - if (y != null) this.y - if (y != null || this.y != null) y.equals(y) - if (y != null || this.y != null) y - if (y != null || this.y != null) this.y.equals(this.y) - if (y != null || this.y != null) this.y - - if (z != null) z.equals(z) - if (z != null) z - if (this.z != null) this.z.equals(this.z) - if (this.z != null) this.z - if (z != null) this.z.equals(this.z) - if (z != null) this.z - if (this.z != null) z.equals(z) - if (this.z != null) z - if (z != null || this.z != null) z.equals(z) - if (z != null || this.z != null) z - if (z != null || this.z != null) this.z.equals(this.z) - if (z != null || this.z != null) this.z - - if (u != null) u.equals(u) - if (u != null) u - if (this.u != null) this.u.equals(this.u) - if (this.u != null) this.u - if (this.u != null) u.equals(u) - if (this.u != null) u - if (u != null) this.u.equals(this.u) - if (u != null) this.u - if (u != null || this.u != null) u.equals(u) - if (u != null || this.u != null) u - if (u != null || this.u != null) this.u.equals(this.u) - if (u != null || this.u != null) this.u - - v = 0 - v.equals(v) - v - if (v != null) v.equals(v) - if (v != null) v - if (this.v != null) v.equals(v) - if (this.v != null) v - if (v != null || this.v != null) v.equals(v) - if (v != null || this.v != null) v - if (v != null || this.v != null) this.v.equals(this.v) - if (v != null || this.v != null) this.v - - w = if (null != null) 10 else null - w - if (w != null) w.equals(w) - if (w != null) w - if (this.w != null) w.equals(w) - if (this.w != null) w - if (w != null || this.w != null) w.equals(w) - if (w != null || this.w != null) w - if (w != null || this.w != null) this.w.equals(this.w) - if (w != null || this.w != null) this.w - - s = null - s.equals(s) - s - if (s != null) s.equals(s) - if (s != null) s - if (this.s != null) s.equals(s) - if (this.s != null) s - if (s != null || this.s != null) s.equals(s) - if (s != null || this.s != null) s - if (s != null || this.s != null) this.s.equals(this.s) - if (s != null || this.s != null) this.s - } - - fun test() { - if (b != null) b.equals(b) - if (b != null) b - - if (c != null) c.equals(c) - if (c != null) c - - if (d != null) d.equals(d) - if (d != null) d - - if (e != null) e.equals(e) - if (e != null) e - - if (f != null) f.equals(f) - if (f != null) f - - if (x != null) x.equals(x) - if (x != null) x - - if (y != null) y.equals(y) - if (y != null) y - - if (z != null) z.equals(z) - if (z != null) z - - if (u != null) u.equals(u) - if (u != null) u - - if (v != null) v.equals(v) - if (v != null) v - - if (w != null) w.equals(w) - if (w != null) w - - if (s != null) s.equals(s) - if (s != null) s - } -} - -fun case_30(a: Case30) { - if (a.x !== null) a.x.equals(a.x) - if (a.x !== null) a.x - if (a.b !== null) a.b.equals(a.b) - if (a.b !== null) a.b - if (a.e !== null) a.e.equals(a.e) - if (a.e !== null) a.e - if (a.f !== null) a.f.equals(a.f) - if (a.f !== null) a.f - if (a.v != null) a.v.equals(a.v) - if (a.v != null) a.v - if (a.w != null) a.w.equals(a.w) - if (a.w != null) a.w - if (a.s != null) a.s.equals(a.s) - if (a.s != null) a.s -} - -// TESTCASE NUMBER: 31 -enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: String?, internal val e: Char?, public val f: Any?) { - A(1, 2f, kotlin.Unit, "", ',', null), B(1, 2f, kotlin.Unit, "", ',', null), C(1, 2f, kotlin.Unit, "", ',', null); - - val x: Char? = '.' - private val y: Unit? = kotlin.Unit - protected val z: Int? = 12 - public val u: String? = "..." - val s: Any? - val v: Int? - val w: Number? - val t: String? = if (u != null) this.u else null - - init { - if (a != null) a.equals(a) - if (a != null) a - - if (b != null) b.equals(b) - if (b != null) b - if (this.b != null) this.b.equals(this.b) - if (this.b != null) this.b - if (this.b != null) b.equals(b) - if (this.b != null) b - if (b != null) this.b.equals(this.b) - if (b != null) this.b - if (b != null || this.b != null) b.equals(b) - if (b != null || this.b != null) b - if (b != null || this.b != null) this.b.equals(this.b) - if (b != null || this.b != null) this.b - - if (c != null) c.equals(c) - if (c != null) c - if (this.c != null) this.c.equals(this.c) - if (this.c != null) this.c - if (c != null) this.c.equals(this.c) - if (c != null) this.c - if (this.c != null) c.equals(c) - if (this.c != null) c - if (c != null || this.c != null) c.equals(c) - if (c != null || this.c != null) c - if (c != null || this.c != null) this.c.equals(this.c) - if (c != null || this.c != null) this.c - - if (d != null) d.equals(d) - if (d != null) d - if (this.d != null) this.d.equals(this.d) - if (this.d != null) this.d - if (d != null) this.d.equals(this.d) - if (d != null) this.d - if (this.d != null) d.equals(d) - if (this.d != null) d - if (d != null || this.d != null) d.equals(d) - if (d != null || this.d != null) d - if (d != null || this.d != null) this.d.equals(this.d) - if (d != null || this.d != null) this.d - - if (e != null) e.equals(e) - if (e != null) e - if (this.e != null) this.e.equals(this.e) - if (this.e != null) this.e - if (this.e != null) e.equals(e) - if (this.e != null) e - if (e != null) this.e.equals(this.e) - if (e != null) this.e - if (e != null || this.e != null) e.equals(e) - if (e != null || this.e != null) e - if (e != null || this.e != null) this.e.equals(this.e) - if (e != null || this.e != null) this.e - - if (f != null) f.equals(f) - if (f != null) f - if (this.f != null) this.f.equals(this.f) - if (this.f != null) this.f - if (this.f != null) f.equals(f) - if (this.f != null) f - if (f != null) this.f.equals(this.f) - if (f != null) this.f - if (f != null || this.f != null) f.equals(f) - if (f != null || this.f != null) f - if (f != null || this.f != null) this.f.equals(this.f) - if (f != null || this.f != null) this.f - - if (x != null) x.equals(x) - if (x != null) x - if (this.x != null) this.x.equals(this.x) - if (this.x != null) this.x - if (x != null) this.x.equals(this.x) - if (x != null) this.x - if (this.x != null) x.equals(x) - if (this.x != null) x - if (x != null || this.x != null) x.equals(x) - if (x != null || this.x != null) x - if (x != null || this.x != null) this.x.equals(this.x) - if (x != null || this.x != null) this.x - - if (y != null) y.equals(y) - if (y != null) y - if (this.y != null) this.y.equals(this.y) - if (this.y != null) this.y - if (this.y != null) y.equals(y) - if (this.y != null) y - if (y != null) this.y.equals(this.y) - if (y != null) this.y - if (y != null || this.y != null) y.equals(y) - if (y != null || this.y != null) y - if (y != null || this.y != null) this.y.equals(this.y) - if (y != null || this.y != null) this.y - - if (z != null) z.equals(z) - if (z != null) z - if (this.z != null) this.z.equals(this.z) - if (this.z != null) this.z - if (z != null) this.z.equals(this.z) - if (z != null) this.z - if (this.z != null) z.equals(z) - if (this.z != null) z - if (z != null || this.z != null) z.equals(z) - if (z != null || this.z != null) z - if (z != null || this.z != null) this.z.equals(this.z) - if (z != null || this.z != null) this.z - - if (u != null) u.equals(u) - if (u != null) u - if (this.u != null) this.u.equals(this.u) - if (this.u != null) this.u - if (this.u != null) u.equals(u) - if (this.u != null) u - if (u != null) this.u.equals(this.u) - if (u != null) this.u - if (u != null || this.u != null) u.equals(u) - if (u != null || this.u != null) u - if (u != null || this.u != null) this.u.equals(this.u) - if (u != null || this.u != null) this.u - - v = 0 - v.equals(v) - v - if (v != null) v.equals(v) - if (v != null) v - if (this.v != null) v.equals(v) - if (this.v != null) v - if (v != null || this.v != null) v.equals(v) - if (v != null || this.v != null) v - if (v != null || this.v != null) this.v.equals(this.v) - if (v != null || this.v != null) this.v - - w = if (null != null) 10 else null - if (w != null) w.equals(w) - if (w != null) w - if (this.w != null) w.equals(w) - if (this.w != null) w - if (w != null || this.w != null) w.equals(w) - if (w != null || this.w != null) w - if (w != null || this.w != null) this.w.equals(this.w) - if (w != null || this.w != null) this.w - - s = null - s.equals(s) - s - if (s != null) s.equals(s) - if (s != null) s - if (this.s != null) s.equals(s) - if (this.s != null) s - if (s != null || this.s != null) s.equals(s) - if (s != null || this.s != null) s - if (s != null || this.s != null) this.s.equals(this.s) - if (s != null || this.s != null) this.s - } - - fun test() { - if (b != null) b.equals(b) - if (b != null) b - - if (c != null) c.equals(c) - if (c != null) c - - if (d != null) d.equals(d) - if (d != null) d - - if (e != null) e.equals(e) - if (e != null) e - - if (f != null) f.equals(f) - if (f != null) f - - if (x != null) x.equals(x) - if (x != null) x - - if (y != null) y.equals(y) - if (y != null) y - - if (z != null) z.equals(z) - if (z != null) z - - if (u != null) u.equals(u) - if (u != null) u - - if (v != null) v.equals(v) - if (v != null) v - - if (w != null) w.equals(w) - if (w != null) w - - if (s != null) s.equals(s) - if (s != null) s - } -} - -fun case_31(a: Case31) { - if (a.x !== null) a.x.equals(a.x) - if (a.x !== null) a.x - if (a.b !== null) a.b.equals(a.b) - if (a.b !== null) a.b - if (a.e !== null) a.e.equals(a.e) - if (a.e !== null) a.e - if (a.f !== null) a.f.equals(a.f) - if (a.f !== null) a.f - if (a.v != null) a.v.equals(a.v) - if (a.v != null) a.v - if (a.w != null) a.w.equals(a.w) - if (a.w != null) a.w - if (a.s != null) a.s.equals(a.s) - if (a.s != null) a.s - - if (Case31.A.b != null) Case31.A.b.equals(Case31.A.b) - if (Case31.A.b != null) Case31.A.b - if (Case31.A.e != null) Case31.A.e.equals(Case31.A.e) - if (Case31.A.e != null) Case31.A.e - if (Case31.A.f != null) Case31.A.f.equals(Case31.A.f) - if (Case31.A.f != null) Case31.A.f -} - -// TESTCASE NUMBER: 32 -object Case32 { - val x: Char? = '.' - private val y: Unit? = kotlin.Unit - public val u: String? = "..." - val s: Any? - val v: Int? - val w: Number? - val t: String? = if (u != null) this.u else null - - init { - if (x != null) x.equals(x) - if (x != null) x - if (this.x != null) this.x.equals(this.x) - if (this.x != null) this.x - if (x != null) this.x.equals(this.x) - if (x != null) this.x - if (this.x != null) x.equals(x) - if (this.x != null) x - if (x != null || this.x != null) x.equals(x) - if (x != null || this.x != null) x - if (x != null || this.x != null) this.x.equals(this.x) - if (x != null || this.x != null) this.x - - if (y != null) y.equals(y) - if (y != null) y - if (this.y != null) this.y.equals(this.y) - if (this.y != null) this.y - if (this.y != null) y.equals(y) - if (this.y != null) y - if (y != null) this.y.equals(this.y) - if (y != null) this.y - if (y != null || this.y != null) y.equals(y) - if (y != null || this.y != null) y - if (y != null || this.y != null) this.y.equals(this.y) - if (y != null || this.y != null) this.y - - if (u != null) u.equals(u) - if (u != null) u - if (this.u != null) this.u.equals(this.u) - if (this.u != null) this.u - if (this.u != null) u.equals(u) - if (this.u != null) u - if (u != null) this.u.equals(this.u) - if (u != null) this.u - if (u != null || this.u != null) u.equals(u) - if (u != null || this.u != null) u - if (u != null || this.u != null) this.u.equals(this.u) - if (u != null || this.u != null) this.u - - v = 0 - v.equals(v) - v - if (v != null) v.equals(v) - if (v != null) v - if (this.v != null) v.equals(v) - if (this.v != null) v - if (v != null || this.v != null) v.equals(v) - if (v != null || this.v != null) v - if (v != null || this.v != null) this.v.equals(this.v) - if (v != null || this.v != null) this.v - - w = if (null != null) 10 else null - if (w != null) w.equals(w) - if (w != null) w - if (this.w != null) w.equals(w) - if (this.w != null) w - if (w != null || this.w != null) w.equals(w) - if (w != null || this.w != null) w - if (w != null || this.w != null) this.w.equals(this.w) - if (w != null || this.w != null) this.w - - s = null - s.equals(s) - s - if (s != null) s.equals(s) - if (s != null) s - if (this.s != null) s.equals(s) - if (this.s != null) s - if (s != null || this.s != null) s.equals(s) - if (s != null || this.s != null) s - if (s != null || this.s != null) this.s.equals(this.s) - if (s != null || this.s != null) this.s - } - - fun test() { - if (x != null) x.equals(x) - if (x != null) x - - if (y != null) y.equals(y) - if (y != null) y - - if (u != null) u.equals(u) - if (u != null) u - - if (v != null) v.equals(v) - if (v != null) v - - if (w != null) w.equals(w) - if (w != null) w - - if (s != null) s.equals(s) - if (s != null) s - } -} - -fun case_32(a: Case32) { - if (a.x != null) a.x.equals(a.x) - if (a.x != null) a.x - if (a.v != null) a.v.equals(a.v) - if (a.v != null) a.v - if (a.w != null) a.w.equals(a.w) - if (a.w != null) a.w - if (a.s != null) a.s.equals(a.s) - if (a.s != null) a.s -} - -// TESTCASE NUMBER: 33 -fun case_33(a: Int?, b: Int = if (a != null) a else 0) { - a - b.equals(b) - b -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.10.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.10.kt deleted file mode 100644 index 797f2a0ac6a..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.10.kt +++ /dev/null @@ -1,371 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 10 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) using if expression and wrapped-unwrapped types. - * HELPERS: classes, functions - */ - -// TESTCASE NUMBER: 1 -fun case_1() { - val x = expandInv(Inv(select(10, null))) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 2 -fun case_2() { - val x = expandOut(Out(select(10, null))) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 3 -fun case_3() { - val x = expandInv(Inv(select(10, null))) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 4 -fun case_4() { - val x = expandOut(Out(select(10, null))) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 5 -fun case_5() { - val x = expandIn(In()) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 6 -fun case_6() { - val x = expandIn(In()) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 7 -fun case_7(x: MutableMap) = select(x.values.first(), x.keys.first()) - -fun case_7() { - val x = case_7(mutableMapOf(10 to 10)) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 8 -fun case_8(x: MutableMap) = select(x.values.first(), x.keys.first()) - -fun case_8() { - val x = case_8(mutableMapOf(10 to null)) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 9 -fun case_9(x: MutableMap) = select(x.values.first(), x.keys.first()) - -fun case_9() { - val x = case_9(mutableMapOf(null to 10)) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 10 -fun case_10(x: MutableMap) = select(x.values.first(), x.keys.first()) - -fun case_10() { - val x = case_10(mutableMapOf(10 to 10)) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 11 -fun case_11(x: MutableMap) = select(x.values.first(), x.keys.first()) - -fun case_11() { - val x = case_11(mutableMapOf(10 to 10)) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 12 -fun case_12(x: MutableMap) = select(x.values.first(), x.keys.first()) - -fun case_12() { - val x = case_12(mutableMapOf(10 to 11)) - - if (x != null) { - x - x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 13 - * ISSUES: KT-28334 - * NOTE: before fix of the issue type is inferred to {Int? & Byte? & Short? & Long?} (smart cast from {Int? & Byte? & Short? & Long?}?) - */ -fun case_13(x: Out?, y: Out) = select(x, y) - -fun case_13() { - val x = case_13(Out(), Out()) - - if (x != null) { - & Out?")!>x - & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - val y = x.get() - if (y != null) { - y - y.equals(y) - } - } -} - -// TESTCASE NUMBER: 14 -fun case_14(x: Out?, y: Out) = select(x, y) - -fun case_14() { - val x = case_14(Out(), Out()) - - if (x != null) { - & Out?")!>x - & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - val y = x.get() - if (y != null) { - y - y.equals(y) - } - } -} - -// TESTCASE NUMBER: 15 -fun case_15(x: Out, y: Out?) = select(x, y) - -fun case_15() { - val x = case_15(Out(), Out()) - - if (x != null) { - & Out?")!>x - & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - val y = x.get() - if (y != null) { - y - y.equals(y) - } - } -} - -/* - * TESTCASE NUMBER: 16 - * ISSUES: KT-28334 - * NOTE: before fix of the issue type is inferred to {Int? & Byte? & Short? & Long?} (smart cast from {Int? & Byte? & Short? & Long?}?) - */ -fun case_16(x: Out, y: Out) = select(x, select(y, null)) - -fun case_16() { - val x = case_16(Out(), Out()) - - if (x != null) { - & Out?")!>x - & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - val y = x.get() - if (y != null) { - y - y.equals(y) - } - } -} - -// TESTCASE NUMBER: 17 -fun case_17(x: Out, y: Out) = select(x, select(y, null)) - -fun case_17() { - val x = case_17(Out(), Out()) - - if (x != null) { - & Out?")!>x - & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - val y = x.get() - if (y != null) { - y - y.equals(y) - } - } -} - -/* - * TESTCASE NUMBER: 18 - * ISSUES: KT-28334 - * NOTE: before fix of the issue type is inferred to {Int? & Byte? & Short? & Long?} (smart cast from {Int? & Byte? & Short? & Long?}?) - */ -fun case_18(x: Out, y: Out) = select(x, y) - -fun case_18() { - val x = case_18(Out(), Out()) - - ")!>x - ")!>x.equals(x) - val y = x.get() - if (y != null) { - y - y.equals(y) - } -} - -// TESTCASE NUMBER: 19 -fun case_19(x: Out, y: Out) = select(x, y) - -fun case_19() { - val x = case_19(Out(), Out()) - - ")!>x - ")!>x.equals(x) - val y = x.get() - if (y != null) { - y - y.equals(y) - } -} - -// TESTCASE NUMBER: 20 -fun case_20(x: Out, y: Out) = select(x.get(), y.get()) - -fun case_20(y: Int?) { - val x = case_20(Out(y), Out()) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 21 -fun case_21(x: Out, y: Out) = select(x.get(), y.get()) - -fun case_21(y: Int?) { - val x = case_21(Out(y), Out()) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 22 -fun case_22(x: Out, y: Out): T? = select(x.get(), y.get()) - -fun case_22(y: Int?) { - val x = case_22(Out(y), Out()) - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 23 -fun case_23(x: Out, y: Out): T = select(x.get(), y.get()) - -fun case_23(y: Int?) { - val x = case_13(Out(y), Out()) - - if (x != null) { - & Out?")!>x - & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - } -} - -// TESTCASE NUMBER: 24 -fun case_24(x: Out, y: Out) where F : E? = select(x.get(), y.get()) - -fun case_24(y: Int) { - val x = case_13(Out(y), Out()) - - if (x != null) { - & Out?")!>x - & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 25 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-29054 - */ -fun , C: Out, D: Out, E: Out, F> case_25(x: F, y: Out) where F : Out = - select(x.get()?.get()?.get()?.get()?.get(), y.get().get().get()) - -fun case_25(y: Int) { - val x = case_25(Out(Out(Out(Out(Out(y))))), Out(Out(Out(y)))) - - if (x != null) { - x - x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 26 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-29054 - */ -fun , C: Out, D: Out, E: Out, F> case_26(x: F, y: Out) where F : Out = - select(x.get()?.get()?.get()?.get()?.get(), y.get().get().get()) - -fun case_26(y: Int) { - val x = case_26(Out(Out(Out(Out(Out(y))))), Out(Out(Out(y)))) - - if (x != null) { - x - x.equals(x) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.11.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.11.kt deleted file mode 100644 index 7bfbc5199bd..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.11.kt +++ /dev/null @@ -1,188 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 11 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) using if expression and wrapped-unwrapped intersection types. - * HELPERS: classes, functions, interfaces - */ - -// TESTCASE NUMBER: 1 -fun , C: Out> case_1(a: C, b: B) = select(a.x, b.x) - -fun case_1() { - val x = case_1(Out(10), Inv(0.1)) - - if (x != null) { - & Number} & {Comparable<{Double & Int}> & Number}?")!>x - & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - } -} - -// TESTCASE NUMBER: 2 -fun , C: Out> case_2(a: C, b: B) = select(a.x, b.x) - -fun case_2(y: Int) { - val x = case_2(Out(y), Inv(0.1)) - - if (x != null) { - & Number} & {Comparable<{Double & Int}> & Number}?")!>x - & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 3 - * ISSUES: KT-28670 - */ -fun case_3(a: Int?, b: Float?, c: Double?, d: Boolean?) { - when (d) { - true -> a - false -> b - null -> c - }.apply { - ? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this - if (this != null) { - ? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this - & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this.equals(this) - } - }.let { - ? & Number?}")!>it - if (it != null) { - & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it - & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 4 - * ISSUES: KT-28670 - */ -fun case_4(a: Interface1?, b: Interface2?, c: Boolean) { - a as Interface2? - b as Interface1? - val x = when (c) { - true -> a - false -> b - } - - x.apply { - this - if (this != null) { - this - this.equals(this) - } - } - x.let { - it - if (it != null) { - it - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 5 - * ISSUES: KT-28670 - */ -fun case_5(a: Interface1?, b: Interface2?, d: Boolean) { - a as Interface2? - b as Interface1 - val x = when (d) { - true -> a - false -> b - } - - x.apply { - if (this != null) { - this - this.equals(this) - } - } - x.let { - if (it != null) { - it - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 6 - * ISSUES: KT-28670 - */ -fun case_6(a: Interface1?, b: Interface2, d: Boolean) { - a as Interface2? - b as Interface1 - val x = when (d) { - true -> a - false -> b - } - - x.apply { - this as Interface3 - this - if (this != null) { - this - this.equals(this) - this.itest1() - this.itest2() - } - } - x.let { - it as Interface3 - it - if (it != null) { - it - it.equals(it) - it.itest1() - it.itest2() - } - } -} - -/* - * TESTCASE NUMBER: 7 - * ISSUES: KT-28670 - */ -fun case_7(a: Interface1?, b: Interface2?, d: Boolean) { - a as Interface2? - b as Interface1? - val x = when (d) { - true -> a - false -> b - } - - x.apply { - this as Interface3? - this - if (this != null) { - this - this.equals(this) - this.itest1() - this.itest2() - } - } - x.let { - it as Interface3? - it - if (it != null) { - it - it.equals(it) - it.itest1() - it.itest2() - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.12.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.12.kt deleted file mode 100644 index d99b68e46b1..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.12.kt +++ /dev/null @@ -1,1720 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 12 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) on generic receivers using if expression. - * HELPERS: classes, interfaces - */ - -// TESTCASE NUMBER: 1 -fun T.case_1() { - if (this != null) { - equals(this) - apply { equals(this); this.equals(this) } - also { it.equals(this) } - } -} - -// TESTCASE NUMBER: 2 -fun T?.case_2() { - if (this != null) { - equals(this) - apply { equals(this); this.equals(this) } - also { it.equals(this) } - } -} - -// TESTCASE NUMBER: 3 -fun T.case_3() { - if (this != null) { - this - this.equals(this) - } -} - -// TESTCASE NUMBER: 4 -fun T?.case_4() { - if (this != null) { - this - this.equals(this) - } -} - -// TESTCASE NUMBER: 5 -fun T?.case_5() { - if (this is Interface1) { - if (this != null) { - this - this.equals(this) - this.itest1() - - equals(this) - itest1() - apply { - this - this - equals(this) - itest1() - this.equals(this) - this.itest1() - } - also { - it - it - it.itest1() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 6 -fun T?.case_6() { - if (this is Interface1?) { - if (this != null) { - this - this.equals(this) - this.itest1() - - equals(this) - itest1() - apply { - this - equals(this) - itest1() - this.equals(this) - this.itest1() - } - also { - it - it.itest1() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 7 -fun T.case_7() { - val x = this - if (x is Interface1?) { - if (x != null) { - x - x.equals(this) - x.itest1() - - x.apply { - this - equals(this) - itest1() - this.equals(this) - this.itest1() - } - x.also { - it - it.itest1() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 8 -fun T.case_8() { - if (this != null) { - if (this is Interface1?) { - this - this.equals(this) - this.itest1() - - equals(this) - itest1() - apply { - this - equals(this) - itest1() - this.equals(this) - this.itest1() - } - also { - it - it.itest1() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 9 -fun T.case_9() { - if (this != null) { - this - this.equals(this) - this.toByte() - - equals(this) - toByte() - apply { - this - equals(this) - toByte() - this.equals(this) - this.toByte() - } - also { - it - it.equals(it) - it.toByte() - } - } -} - -// TESTCASE NUMBER: 10 -fun T.case_10() { - if (this != null) { - this - this.equals(this) - this.toByte() - - equals(this) - toByte() - apply { - this - equals(this) - toByte() - this.equals(this) - this.toByte() - } - also { - it - it.toByte() - it.equals(it) - } - } -} - -// TESTCASE NUMBER: 11 -fun T?.case_11() { - if (this is Interface1?) { - if (this != null) { - this - this.equals(this) - this.itest1() - - equals(this) - itest1() - apply { - this - equals(this) - itest1() - this.equals(this) - this.itest1() - } - also { - it - it.itest1() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 12 -fun T.case_12() where T : Number?, T: Interface1? { - if (this != null) { - this - this.equals(this) - this.itest1() - this.toByte() - - equals(this) - itest1() - apply { - this - equals(this) - itest1() - this.equals(this) - this.itest1() - } - also { - it - it.itest1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 13 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T.case_13() where T : Out<*>?, T: Comparable { - if (this != null) { - this - this.equals(this) - this.get() - this.compareTo(null) - - equals(this) - get() - compareTo(null) - apply { - this - equals(this) - get() - compareTo(null) - this.equals(this) - this.get() - this.compareTo(null) - } - also { - it - it.get() - it.equals(it) - it.compareTo(null) - } - } -} - -/* - * TESTCASE NUMBER: 14 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> T.case_14() { - if (this != null) { - this - this.equals(this) - this.get() - - equals(this) - get() - apply { - this - equals(this) - get() - this.equals(this) - this.get() - } - also { - it - it.get() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 15 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> T.case_15() { - if (this != null) { - this - this.equals(this) - this.itest1() - - equals(this) - itest1() - apply { - this - equals(this) - itest1() - this.equals(this) - this.itest1() - } - also { - it - it.itest1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 16 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> T.case_16() { - if (this != null) { - this - this.equals(this) - this.ip1test1() - - equals(this) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(this) - this.ip1test1() - } - also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 17 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> T.case_17() { - if (this != null) { - this - this.equals(this) - this.ip1test1() - - equals(this) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(this) - this.ip1test1() - } - also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 18 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> T.case_18() { - val y = this - - if (y != null) { - y - y.equals(y) - y.ip1test1() - - equals(y) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(y) - this.ip1test1() - } - also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 19 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> T.case_19() { - if (this != null) { - this - this.equals(this) - this.ip1test1() - - equals(this) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(this) - this.ip1test1() - } - also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 20 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T.case_20() where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2? { - if (this != null) { - this - this.equals(this) - this.ip1test1() - this.ip1test2() - - equals(this) - ip1test1() - ip1test2() - apply { - this - equals(this) - ip1test1() - ip1test2() - this.equals(this) - this.ip1test1() - this.ip1test2() - } - also { - it - it.equals(it) - it.ip1test1() - it.ip1test2() - } - } -} - -/* - * TESTCASE NUMBER: 21 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T.case_21() where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2?, T: InterfaceWithTypeParameter3? { - if (this != null) { - this - this.equals(this) - this.ip1test1() - this.ip1test2() - this.ip1test3() - - equals(this) - ip1test1() - ip1test2() - ip1test3() - apply { - this - equals(this) - ip1test1() - ip1test2() - ip1test3() - this.equals(this) - this.ip1test1() - this.ip1test2() - this.ip1test3() - } - also { - it - it.equals(it) - it.ip1test1() - it.ip1test2() - it.ip1test3() - } - } -} - -/* - * TESTCASE NUMBER: 22 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun >?> T.case_22() { - var y = this - - if (y != null) { - y - y.equals(y) - y.ip1test1() - - equals(y) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(this) - this.ip1test1() - } - also { - it - it.equals(it) - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 23 -fun >?> T.case_23() { - if (this != null) { - this - this.equals(this) - this.ip1test1() - - equals(this) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(this) - this.ip1test1() - } - also { - it - it.equals(it) - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 24 -fun > InterfaceWithTypeParameter1?.case_24() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 25 -fun > InterfaceWithTypeParameter1?.case_25() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 26 -fun > InterfaceWithTypeParameter1?.case_26() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 27 -fun > InterfaceWithTypeParameter1?.case_27() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 28 -fun > InterfaceWithTypeParameter1?.case_28() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 29 -fun > InterfaceWithTypeParameter1?.case_29() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 30 -fun > InterfaceWithTypeParameter1?.case_30() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 31 -fun > InterfaceWithTypeParameter1?.case_31() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 32 -fun Map?.case_32() { - if (this != null) { - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(this) - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() - - equals(this) - isEmpty() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 33 -fun InterfaceWithFiveTypeParameters1?.case_33() { - if (this != null) { - & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this - & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.equals(this) - & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.itest() - - equals(this) - itest() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this - equals(this) - itest() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.itest() - } - } -} - -// TESTCASE NUMBER: 34 -fun InterfaceWithTypeParameter1?.case_34() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 35 -fun InterfaceWithTypeParameter1?.case_35() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 36 -fun InterfaceWithTypeParameter1?.case_36() { - if (this != null) { - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(this) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() - - equals(this) - ip1test1() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 37 -fun Map?.case_37() { - if (this != null) { - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(this) - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() - - equals(this) - isEmpty() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 38 -fun Map<*, out T>?.case_38() { - if (this != null) { - & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this - & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.equals(this) - & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.isEmpty() - - equals(this) - isEmpty() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 39 -fun InterfaceWithTwoTypeParameters?.case_39() { - if (this != null) { - & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this - & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.equals(this) - - equals(this) - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this - equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(this) - } - also { - ")!>it - ")!>it.equals(it) - } - } -} - -// TESTCASE NUMBER: 40 -fun InterfaceWithTwoTypeParameters?.case_40() { - if (this != null) { - & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this - & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.equals(this) - - equals(this) - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this - equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(this) - } - also { - ")!>it - ")!>it.equals(it) - } - } -} - -// TESTCASE NUMBER: 41 -fun Mapout T>?.case_41() { - if (this != null) { - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(this) - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() - - equals(this) - isEmpty() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 42 -fun Mapout T>?.case_42() { - if (this != null) { - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(this) - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() - - equals(this) - isEmpty() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 43 -fun Map?.case_43() { - if (this != null) { - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(this) - & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() - - equals(this) - isEmpty() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 44 -fun InterfaceWithFiveTypeParameters1?.case_44() { - if (this != null) { - & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this - & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.equals(this) - & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.itest() - - equals(this) - itest() - apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this - equals(this) - itest() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() - } - also { - ")!>it - ")!>it.equals(it) - ")!>it.itest() - } - } -} - -// TESTCASE NUMBER: 45 -fun T.case_45() where T : Number?, T: Comparable? { - if (this != null) { - this - this.equals(this) - this.toByte() - this.compareTo(this) - - equals(this) - toByte() - compareTo(this) - apply { - this - equals(this) - compareTo(this) - toByte() - this.equals(this) - this.compareTo(this) - this.toByte() - } - also { - it - it.equals(it) - it.compareTo(it) - it.toByte() - } - } -} - -// TESTCASE NUMBER: 46 -fun T.case_46() where T : CharSequence?, T: Comparable?, T: Iterable<*>? { - if (this != null) { - this - this.equals(this) - this.compareTo(this) - this.get(0) - this.iterator() - - equals(this) - compareTo(this) - get(0) - iterator() - apply { - this - equals(this) - compareTo(this) - get(0) - iterator() - this.equals(this) - this.compareTo(this) - this.get(0) - this.iterator() - } - also { - it - it.equals(it) - it.compareTo(it) - it.get(0) - it.iterator() - } - } -} - -/* - * TESTCASE NUMBER: 47 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T?.case_47() where T : Inv, T: Comparable<*>?, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - - this.compareTo(return) - compareTo(return) - - apply { - compareTo(return) - this.compareTo(return) - } - - also { - it.compareTo(return) - } - } -} - -/* - * TESTCASE NUMBER: 48 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T?.case_48() where T : Inv, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 49 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T?.case_49() where T : Inv, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 50 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T?.case_50() where T : Inv, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 51 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T?.case_51() where T : Inv, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 52 -fun T?.case_52() where T : Inv, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 53 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T?.case_53() where T : Inv, T: InterfaceWithTypeParameter1<*>? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 54 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T?.case_54() where T : Inv<*>, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 55 -fun T?.case_55() where T : Inv<*>, T: InterfaceWithTypeParameter1? { - if (this != null) { - this - this.equals(this) - this.get() - this.ip1test1() - - equals(this) - get() - ip1test1() - apply { - this - equals(this) - get() - ip1test1() - this.equals(this) - this.get() - this.ip1test1() - } - also { - it - it.equals(it) - it.get() - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 56 -fun T.case_56() where T : Number?, T: Interface1? { - if (this != null) { - this - this.equals(this) - this.itest() - this.toByte() - - equals(this) - itest() - toByte() - apply { - this - equals(this) - itest() - toByte() - this.equals(this) - this.itest() - this.toByte() - } - also { - it - it.equals(it) - it.itest() - it.toByte() - } - } -} - -/* - * TESTCASE NUMBER: 57 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T.case_57() where T : Out<*>?, T: Comparable { - if (this != null) { - this - this.equals(this) - this.get() - this.compareTo(null) - - equals(this) - get() - compareTo(null) - apply { - this - equals(this) - get() - compareTo(null) - this.equals(this) - this.get() - this.compareTo(null) - } - also { - it - it.equals(it) - it.get() - it.compareTo(null) - } - } -} - -// TESTCASE NUMBER: 58 -fun >>>>>>>>>?> T.case_59() { - if (this != null) { - this - this.equals(this) - this.ip1test1() - - equals(this) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(this) - this.ip1test1() - } - also { - it - it.equals(it) - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 59 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T.case_59() where T: InterfaceWithFiveTypeParameters1?, T: InterfaceWithFiveTypeParameters2?, T: InterfaceWithFiveTypeParameters3? { - if (this != null) { - this - this.equals(this) - this.itest1() - this.itest2() - this.itest3() - - equals(this) - itest1() - itest2() - itest3() - apply { - this - equals(this) - itest1() - itest2() - itest3() - this.equals(this) - this.itest1() - this.itest2() - this.itest3() - } - also { - it - it.equals(it) - it.itest1() - it.itest2() - it.itest3() - } - } -} - -/* - * TESTCASE NUMBER: 60 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> T.case_60() { - if (this != null) { - this - this.equals(this) - this.ip1test1() - - equals(this) - ip1test1() - apply { - this - equals(this) - ip1test1() - this.equals(this) - this.ip1test1() - } - also { - it - it.equals(it) - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 61 -interface Case61_1: InterfaceWithTypeParameter1, Case61_2 { fun test1() } -interface Case61_2: InterfaceWithTypeParameter1 { fun test2() } - -class Case61_3: InterfaceWithTypeParameter1, Case61_1, Case61_2 { - override fun test1() {} - override fun test2() {} - fun test4() {} -} - -fun T.case_61() where T : InterfaceWithTypeParameter1?, T: Case61_3?, T: Case61_1?, T: Case61_2? { - if (this != null) { - this.test1() - this.test2() - this.ip1test1() - this.test4() - - test1() - test2() - ip1test1() - test4() - apply { - this - test1() - test2() - ip1test1() - test4() - this.test1() - this.test2() - this.ip1test1() - this.test4() - } - also { - it - it.test1() - it.test2() - it.ip1test1() - it.test4() - } - } -} - -// TESTCASE NUMBER: 62 -fun Nothing?.case_62() { - if (this != null) { - this - this.equals(this) - - equals(this) - apply { - this - equals(this) - this.equals(this) - } - also { - it - it.equals(this) - } - } -} - -// TESTCASE NUMBER: 63 -fun Nothing.case_63() { - if (this != null) { - this - this.hashCode() - - hashCode() - apply { - this - hashCode() - this.hashCode() - } - also { - it - it.hashCode() - } - } -} - -/* - * TESTCASE NUMBER: 64 - * UNEXPECTED BEHAVIOUR - */ -fun T.case_64() { - if (this != null) { - this - this.hashCode() - - hashCode() - apply { - this - hashCode() - this.hashCode() - } - also { - it - it.hashCode() - } - } -} - -/* - * TESTCASE NUMBER: 65 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun T.case_65() { - if (this is Interface1?) { - if (this is Interface2?) { - if (this != null) { - this - this.equals(x) - apply { - this - this.equals(this) - } - also { - it - it.equals(it) - } - } - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.13.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.13.kt deleted file mode 100644 index f7c4735cd50..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.13.kt +++ /dev/null @@ -1,1662 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 13 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) on generic function parameters using if expression. - * HELPERS: classes, interfaces - */ - -// TESTCASE NUMBER: 1 -fun case_1(x: T) { - var y = null - - if (y != x) { - x - x.equals(x) - x.apply { equals(x); x.equals(x) } - x.also { it.equals(x) } - } -} - -// TESTCASE NUMBER: 2 -fun case_2(x: T?, y: Nothing?) { - if (y != x) { - x - x.equals(x) - x.apply { equals(x); x.equals(x) } - x.also { it.equals(x) } - } -} - -// TESTCASE NUMBER: 3 -fun case_3(x: T) { - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 4 -fun case_4(x: T?) { - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 5 -fun case_5(x: T?) { - if (x is Interface1) { - if (x != null) { - x - x.equals(x) - x.itest() - - x.equals(x) - x.itest() - x.apply { - this - this - equals(this) - itest() - this.equals(x) - this.itest() - } - x.also { - it - it - it.itest() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 6 -fun case_6(x: T?) { - if (x is Interface1?) { - if (x != null) { - x - x.equals(x) - x.itest() - - x.equals(x) - x.itest() - x.apply { - this - equals(this) - itest() - this.equals(x) - this.itest() - } - x.also { - it - it.itest() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 7 -fun case_7(y: T) { - val x = y - if (x is Interface1?) { - if (x != null) { - x - x.equals(x) - x.itest() - - x.apply { - this - equals(this) - itest() - this.equals(x) - this.itest() - } - x.also { - it - it.itest() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 8 -fun case_8(x: T) { - if (x != null) { - if (x is Interface1?) { - x - x.equals(x) - x.itest() - - x.equals(x) - x.itest() - x.apply { - this - equals(this) - itest() - this.equals(x) - this.itest() - } - x.also { - it - it.itest() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 9 -fun case_9(x: T) { - if (x != null) { - x - x.equals(x) - x.toByte() - - x.equals(x) - x.toByte() - x.apply { - this - equals(this) - x.toByte() - this.equals(x) - this.toByte() - } - x.also { - it - it.equals(it) - it.toByte() - } - } -} - -// TESTCASE NUMBER: 10 -fun case_10(x: T) { - if (x != null) { - x - x.equals(x) - x.toByte() - - x.equals(x) - x.toByte() - x.apply { - this - equals(this) - toByte() - this.equals(x) - this.toByte() - } - x.also { - it - it.toByte() - it.equals(it) - } - } -} - -// TESTCASE NUMBER: 11 -fun case_11(x: T?) { - if (x is Interface1?) { - if (x != null) { - x - x.equals(x) - x.itest() - - x.equals(x) - x.itest() - x.apply { - this - equals(this) - itest() - this.equals(x) - this.itest() - } - x.also { - it - it.itest() - it.equals(it) - } - } - } -} - -// TESTCASE NUMBER: 12 -fun case_12(x: T) where T : Number?, T: Interface1? { - if (x != null) { - x - x.equals(x) - x.itest() - x.toByte() - - x.equals(x) - x.itest() - x.apply { - this - equals(this) - itest() - this.equals(x) - this.itest() - } - x.also { - it - it.itest() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 13 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_13(x: T) where T : Out<*>?, T: Comparable { - if (x != null) { - x - x.equals(x) - x.get() - x.compareTo(null) - - x.equals(x) - x.get() - x.compareTo(null) - x.apply { - this - equals(this) - get() - compareTo(null) - this.equals(x) - this.get() - this.compareTo(null) - } - x.also { - it - it.get() - it.equals(it) - it.compareTo(null) - } - } -} - -/* - * TESTCASE NUMBER: 14 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> case_14(x: T) { - if (x != null) { - x - x.equals(x) - x.get() - - x.equals(x) - x.get() - x.apply { - this - equals(this) - get() - this.equals(x) - this.get() - } - x.also { - it - it.get() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 15 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> case_15(x: T) { - if (x != null) { - x - x.equals(x) - x.itest() - - x.equals(x) - x.itest() - x.apply { - this - equals(this) - itest() - this.equals(x) - this.itest() - } - x.also { - it - it.itest() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 16 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> case_16(x: T) { - if (x != null) { - x - x.equals(x) - x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(x) - this.ip1test1() - } - x.also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 17 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> case_17(x: T) { - if (x != null) { - x - x.equals(x) - x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(x) - this.ip1test1() - } - x.also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 18 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> case_18(x: T) { - val y = x - - if (y != null) { - y - y.equals(y) - y.ip1test1() - - x.equals(y) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(y) - this.ip1test1() - } - x.also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 19 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> case_19(x: T) { - if (x != null) { - x - x.equals(x) - x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(x) - this.ip1test1() - } - x.also { - it - it.ip1test1() - it.equals(it) - } - } -} - -/* - * TESTCASE NUMBER: 20 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_20(x: T) where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2? { - if (x != null) { - x - x.equals(x) - x.ip1test1() - x.ip1test2() - - x.equals(x) - x.ip1test1() - x.ip1test2() - x.apply { - this - equals(this) - ip1test1() - ip1test2() - this.equals(x) - this.ip1test1() - this.ip1test2() - } - x.also { - it - it.equals(it) - it.ip1test1() - it.ip1test2() - } - } -} - -/* - * TESTCASE NUMBER: 21 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_21(x: T) where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2?, T: InterfaceWithTypeParameter3? { - if (x != null) { - x - x.equals(x) - x.ip1test1() - x.ip1test2() - x.ip1test3() - - x.equals(x) - x.ip1test1() - x.ip1test2() - x.ip1test3() - x.apply { - this - equals(this) - ip1test1() - ip1test2() - ip1test3() - this.equals(x) - this.ip1test1() - this.ip1test2() - this.ip1test3() - } - x.also { - it - it.equals(it) - it.ip1test1() - it.ip1test2() - it.ip1test3() - } - } -} - -/* - * TESTCASE NUMBER: 22 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun >?> case_22(x: T) { - var y = x - - if (y != null) { - y - y.equals(y) - y.ip1test1() - - x.equals(y) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(x) - this.ip1test1() - } - x.also { - it - it.equals(it) - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 23 -fun >?> case_23(x: T) { - if (x != null) { - x - x.equals(x) - x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(x) - this.ip1test1() - } - x.also { - it - it.equals(it) - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 24 -fun > case_24(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 25 -fun > case_25(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 26 -fun > case_26(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 27 -fun > case_27(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 28 -fun > case_28(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 29 -fun > case_29(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 30 -fun > case_30(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 31 -fun > case_31(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 32 -fun case_32(x: Map?) { - if (x != null) { - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) - & kotlin.collections.Map?")!>x.isEmpty() - - x.equals(x) - x.isEmpty() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 33 -fun case_33(x: InterfaceWithFiveTypeParameters1?) { - if (x != null) { - & InterfaceWithFiveTypeParameters1?")!>x - & InterfaceWithFiveTypeParameters1?")!>x.equals(x) - & InterfaceWithFiveTypeParameters1?")!>x.itest() - - x.equals(x) - x.itest() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this - equals(this) - itest() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.itest() - } - } -} - -// TESTCASE NUMBER: 34 -fun case_34(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 35 -fun case_35(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 36 -fun case_36(x: InterfaceWithTypeParameter1?) { - if (x != null) { - & InterfaceWithTypeParameter1?")!>x - & InterfaceWithTypeParameter1?")!>x.equals(x) - & InterfaceWithTypeParameter1?")!>x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this - equals(this) - ip1test1() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 37 -fun case_37(x: Map?) { - if (x != null) { - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) - & kotlin.collections.Map?")!>x.isEmpty() - - x.equals(x) - x.isEmpty() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 38 -fun case_38(x: Map<*, out T>?) { - if (x != null) { - & kotlin.collections.Map<*, out T>?")!>x - & kotlin.collections.Map<*, out T>?")!>x.equals(x) - & kotlin.collections.Map<*, out T>?")!>x.isEmpty() - - x.equals(x) - x.isEmpty() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 39 -fun case_39(x: InterfaceWithTwoTypeParameters?) { - if (x != null) { - & InterfaceWithTwoTypeParameters?")!>x - & InterfaceWithTwoTypeParameters?")!>x.equals(x) - - x.equals(x) - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this - equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(x) - } - x.also { - ")!>it - ")!>it.equals(it) - } - } -} - -// TESTCASE NUMBER: 40 -fun case_40(x: InterfaceWithTwoTypeParameters?) { - if (x != null) { - & InterfaceWithTwoTypeParameters?")!>x - & InterfaceWithTwoTypeParameters?")!>x.equals(x) - - x.equals(x) - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this - equals(this) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(x) - } - x.also { - ")!>it - ")!>it.equals(it) - } - } -} - -// TESTCASE NUMBER: 41 -fun case_41(x: Mapout T>?) { - if (x != null) { - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) - & kotlin.collections.Map?")!>x.isEmpty() - - x.equals(x) - x.isEmpty() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 42 -fun case_42(x: Mapout T>?) { - if (x != null) { - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) - & kotlin.collections.Map?")!>x.isEmpty() - - x.equals(x) - x.isEmpty() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 43 -fun case_43(x: Map?) { - if (x != null) { - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) - & kotlin.collections.Map?")!>x.isEmpty() - - x.equals(x) - x.isEmpty() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this - equals(this) - isEmpty() - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.isEmpty() - } - } -} - -// TESTCASE NUMBER: 44 -fun case_44(x: InterfaceWithFiveTypeParameters1?) { - if (x != null) { - & InterfaceWithFiveTypeParameters1?")!>x - & InterfaceWithFiveTypeParameters1?")!>x.equals(x) - & InterfaceWithFiveTypeParameters1?")!>x.itest() - - x.equals(x) - x.itest() - x.apply { - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this - equals(this) - itest() - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(x) - "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() - } - x.also { - ")!>it - ")!>it.equals(it) - ")!>it.itest() - } - } -} - -// TESTCASE NUMBER: 45 -fun case_45(x: T) where T : Number?, T: Comparable? { - if (x != null) { - x - x.equals(x) - x.toByte() - x.compareTo(x) - - x.equals(x) - x.toByte() - x.compareTo(x) - x.apply { - this - equals(this) - compareTo(this) - x.toByte() - this.equals(x) - this.compareTo(x) - this.toByte() - } - x.also { - it - it.equals(it) - it.compareTo(it) - it.toByte() - } - } -} - -// TESTCASE NUMBER: 46 -fun case_46(x: T) where T : CharSequence?, T: Comparable?, T: Iterable<*>? { - if (x != null) { - x - x.equals(x) - x.compareTo(x) - x.get(0) - x.iterator() - - x.equals(x) - x.compareTo(x) - x.get(0) - x.iterator() - x.apply { - this - equals(this) - compareTo(this) - get(0) - iterator() - this.equals(x) - this.compareTo(x) - this.get(0) - this.iterator() - } - x.also { - it - it.equals(it) - it.compareTo(it) - it.get(0) - it.iterator() - } - } -} - -/* - * TESTCASE NUMBER: 47 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_47(x: T?) where T : Inv, T: Comparable<*>?, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - - x.compareTo(return) - x.compareTo(return) - - x.apply { - compareTo(return) - this.compareTo(return) - } - - x.also { - it.compareTo(return) - } - } -} - -/* - * TESTCASE NUMBER: 48 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_48(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 49 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_49(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 50 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_50(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 51 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_51(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 52 -fun case_52(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 53 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_53(x: T?) where T : Inv, T: InterfaceWithTypeParameter1<*>? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 54 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_54(x: T?) where T : Inv<*>, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 55 -fun case_55(x: T?) where T : Inv<*>, T: InterfaceWithTypeParameter1? { - if (x != null) { - x - x.equals(x) - x.test() - x.ip1test1() - - x.equals(x) - x.test() - x.ip1test1() - x.apply { - this - equals(this) - test() - ip1test1() - this.equals(x) - this.test() - this.ip1test1() - } - x.also { - it - it.equals(it) - it.test() - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 56 -fun case_56(x: T) where T : Number?, T: Interface1? { - if (x != null) { - x - x.equals(x) - x.itest() - x.toByte() - - x.equals(x) - x.itest() - x.toByte() - x.apply { - this - equals(this) - itest() - x.toByte() - this.equals(x) - this.itest() - this.toByte() - } - x.also { - it - it.equals(it) - it.itest() - it.toByte() - } - } -} - -/* - * TESTCASE NUMBER: 57 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_57(x: T) where T : Out<*>?, T: Comparable { - if (x != null) { - x - x.equals(x) - x.get() - x.compareTo(null) - - x.equals(x) - x.get() - x.compareTo(null) - x.apply { - this - equals(this) - get() - compareTo(null) - this.equals(x) - this.get() - this.compareTo(null) - } - x.also { - it - it.equals(it) - it.get() - it.compareTo(null) - } - } -} - -// TESTCASE NUMBER: 58 -fun >>>>>>>>>?> case_59(x: T) { - if (x != null) { - x - x.equals(x) - x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(x) - this.ip1test1() - } - x.also { - it - it.equals(it) - it.ip1test1() - } - } -} - -/* - * TESTCASE NUMBER: 59 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_59(x: T) where T: InterfaceWithFiveTypeParameters1?, T: InterfaceWithFiveTypeParameters2?, T: InterfaceWithFiveTypeParameters3? { - if (x != null) { - x - x.equals(x) - x.itest1() - x.itest2() - x.itest3() - - x.equals(x) - x.itest1() - x.itest2() - x.itest3() - x.apply { - this - equals(this) - itest1() - itest2() - itest3() - this.equals(x) - this.itest1() - this.itest2() - this.itest3() - } - x.also { - it - it.equals(it) - it.itest1() - it.itest2() - it.itest3() - } - } -} - -/* - * TESTCASE NUMBER: 60 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun ?> case_60(x: T) { - if (x != null) { - x - x.equals(x) - x.ip1test1() - - x.equals(x) - x.ip1test1() - x.apply { - this - equals(this) - ip1test1() - this.equals(x) - this.ip1test1() - } - x.also { - it - it.equals(it) - it.ip1test1() - } - } -} - -// TESTCASE NUMBER: 61 -interface Case61_1: InterfaceWithTypeParameter1, Case61_2 { fun test1() } -interface Case61_2: InterfaceWithTypeParameter1 { fun test2() } - -class Case61_3: InterfaceWithTypeParameter1, Case61_1, Case61_2 { - override fun test1() {} - override fun test2() {} - fun test4() {} -} - -fun T.case_61(x: T) where T : InterfaceWithTypeParameter1?, T: Case61_3?, T: Case61_1?, T: Case61_2? { - if (x != null) { - x.ip1test1() - x.test2() - x.ip1test1() - x.test4() - - x.ip1test1() - x.test2() - x.ip1test1() - x.test4() - x.apply { - this - ip1test1() - test2() - ip1test1() - test4() - this.ip1test1() - this.test2() - this.ip1test1() - this.test4() - } - x.also { - it - it.ip1test1() - it.test2() - it.ip1test1() - it.test4() - } - } -} - -/* - * TESTCASE NUMBER: 62 - * UNEXPECTED BEHAVIOUR - */ -fun case_62(x: T) { - if (x != null) { - x - x.hashCode() - - x.hashCode() - x.apply { - this - hashCode() - this.hashCode() - } - x.also { - it - it.hashCode() - } - } -} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.16.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.16.kt deleted file mode 100644 index 6b7f70465bc..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.16.kt +++ /dev/null @@ -1,405 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION, -NAME_SHADOWING, -UNUSED_VARIABLE -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 16 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality with `null` and `return` after it) using if expression. - * UNSPECIFIED BEHAVIOR - * HELPERS: objects, properties, classes - */ - -// TESTCASE NUMBER: 1 -fun case_1(x: Int?) { - if (x == null) return - x - x.inv() -} - -// TESTCASE NUMBER: 2 -fun case_2(x: Unit?) { - if (x === null) return - x - x.equals(x) -} - -// TESTCASE NUMBER: 3 -fun case_3(x: Nothing?) { - if (x != null) else return - x - x.equals(x) -} - -// TESTCASE NUMBER: 4 -fun case_4(x: Number?) { - if (x !== null) else { return } - x - x.equals(x) -} - -// TESTCASE NUMBER: 5 -fun case_5(x: Char?, y: Nothing?) { - if (x != y) else return - x - x.equals(x) -} - -// TESTCASE NUMBER: 6 -fun case_6(x: Object?) { - if (x !== implicitNullableNothingProperty) else { return } - x - x.equals(x) -} - -// TESTCASE NUMBER: 7 -fun case_7(x: Class?) { - if (x === implicitNullableNothingProperty || false || false || false) { return } - x - x.equals(x) -} - -// TESTCASE NUMBER: 8 -fun case_8(x: Int?) { - if (false || false || false || x == nullableNothingProperty) return - x - x.inv() -} - -// TESTCASE NUMBER: 9 -fun case_9(x: String?) { - if (x != implicitNullableNothingProperty && true && true && true) else { return } - x - x.equals(x) -} - -// TESTCASE NUMBER: 10 -fun case_10(x: Float?) { - if (true && true && true && x !== null) else return - x - x.equals(x) -} - -// TESTCASE NUMBER: 11 -fun case_11(x: Out<*>?) { - if (x == null) return - & Out<*>?")!>x - & Out<*>?")!>x.equals(x) -} - -// TESTCASE NUMBER: 12 -fun case_12(x: Map?) { - if (x === null) return - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.equals(x) -} - -// TESTCASE NUMBER: 13 -fun case_13(x: Map?) { - if (x != null) else return - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) -} - -// TESTCASE NUMBER: 14 -fun case_14(x: MutableCollection?) { - if (x !== null) else { return } - & kotlin.collections.MutableCollection?")!>x - & kotlin.collections.MutableCollection?")!>x.equals(x) -} - -// TESTCASE NUMBER: 15 -fun case_15(x: MutableCollection?, y: Nothing?) { - if (x != y) else return - & kotlin.collections.MutableCollection?")!>x - & kotlin.collections.MutableCollection?")!>x.equals(x) -} - -// TESTCASE NUMBER: 16 -fun case_16(x: Collection>>>>>>?) { - if (x !== implicitNullableNothingProperty) else { return } - >>>>>> & kotlin.collections.Collection>>>>>>?")!>x - >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.equals(x) -} - -// TESTCASE NUMBER: 17 -fun case_17(x: MutableMap<*, *>?) { - if (x === implicitNullableNothingProperty || false) { return } - & kotlin.collections.MutableMap<*, *>?")!>x - & kotlin.collections.MutableMap<*, *>?")!>x.equals(x) -} - -// TESTCASE NUMBER: 18 -fun case_18(x: MutableMap?) { - if (false || false || false || x == nullableNothingProperty) return - & kotlin.collections.MutableMap?")!>x - & kotlin.collections.MutableMap?")!>x.equals(x) -} - -// TESTCASE NUMBER: 19 -fun case_19(x: Inv>>>>>>?) { - if (x === implicitNullableNothingProperty && true) else { return } - >>>>>>? & kotlin.Nothing?")!>x - >>>>>>? & kotlin.Nothing?")!>x.equals(x) -} - -// TESTCASE NUMBER: 20 -fun case_20(x: Inv>>>>>>?) { - if (true && true && true && x !== null) else return - >>>>>> & Inv>>>>>>?")!>x - >>>>>> & Inv>>>>>>?")!>x.equals(x) -} - -// TESTCASE NUMBER: 21 -fun case_21(x: T) { - if (x == null) return - x - x.equals(x) -} - -// TESTCASE NUMBER: 22 -fun case_22(x: T?) { - if (x === null) return - x - x.equals(x) -} - -// TESTCASE NUMBER: 23 -fun case_23(x: Inv?) { - if (x !== null) else return - & Inv?")!>x - & Inv?")!>x.equals(x) -} - -// TESTCASE NUMBER: 24 -fun case_24(x: Inv?, y: Nothing?) { - if (x !== y && true) else return - & Inv?")!>x - & Inv?")!>x.equals(x) -} - -// TESTCASE NUMBER: 25 -fun case_25(x: Int?) { - val x = (l@ { - if (x == null) return@l - x - x.inv() - })() -} - -// TESTCASE NUMBER: 26 -fun case_26(x: Unit?, y: List<*>) { - y.forEach l@ { - if (x === null) return@l - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 27 -fun case_27(x: Nothing?) = (l@ { - if (x != null) else return@l - x - x.equals(x) -})() - -// TESTCASE NUMBER: 28 -fun case_28(x: Number?) { - {(l@ { - if (x !== null) else { return@l } - x - x.equals(x) - })()}() -} - -// TESTCASE NUMBER: 29 -fun case_29(x: Char?, y: Nothing?) = l@ { - if (x != y) else return@l - x - x.equals(x) -} - -// TESTCASE NUMBER: 30 -fun case_30(x: Object?): Any { - return (l@ { - if (x !== implicitNullableNothingProperty) else { return@l } - x - x.equals(x) - })() -} - -// TESTCASE NUMBER: 31 -fun case_31(x: Class?): Any { - return l@ { - if (x === implicitNullableNothingProperty || false || false || false) { return@l } - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 32 -fun case_32(x: Any?) { - case_32((l@ { - if (false || false || false || x == nullableNothingProperty) return@l - x - x.equals(x) - })()) -} - -// TESTCASE NUMBER: 33 -fun case_33(x: Any?) { - case_33(l@ { - if (x != implicitNullableNothingProperty && true && true && true) else { return@l } - x - x.equals(x) - }) -} - -// TESTCASE NUMBER: 34 -fun case_34(x: Float?) { - (l@ { - if (true && true && true && x !== null) else return@l - x - x.equals(x) - }).equals(l@ { - if (true && true && true && x !== null) else return@l - x - x.equals(x) - }) -} - -// TESTCASE NUMBER: 35 -fun case_35(x: Any?) { - case_35 l@ { - if (x == null) return@l - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 36 -fun case_36(x: Any?) { - case_36 l@ { - if (x === null) return@l - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 37 -fun case_37(x: Any?): Any? = case_37 l@ { - if (x === null) return@l - x - x.equals(x) -} - -// TESTCASE NUMBER: 38 -fun case_39(x: MutableCollection?) { - (l1@ { - (l2@ { - if (x !== null) else { - return@l2 - } - & kotlin.collections.MutableCollection?")!>x - & kotlin.collections.MutableCollection?")!>x.equals(x) - })() - })() -} - -// TESTCASE NUMBER: 39 -fun case_39(x: MutableCollection?, y: Nothing?) { - (l2@ { - if (x != y) else return@l2 - & kotlin.collections.MutableCollection?")!>x - & kotlin.collections.MutableCollection?")!>x.equals(x) - })() -} - -// TESTCASE NUMBER: 40 -fun case_40(x: Collection>>>>>>?) { - val z = (l@ { - if (x !== implicitNullableNothingProperty) else { return@l } - >>>>>> & kotlin.collections.Collection>>>>>>?")!>x - >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - })() -} - -// TESTCASE NUMBER: 41 -fun case_41(x: MutableMap<*, *>?) { - listOf(l@ { - if (x === implicitNullableNothingProperty || false) { return@l } - & kotlin.collections.MutableMap<*, *>?")!>x - & kotlin.collections.MutableMap<*, *>?")!>x.equals(x) - }) -} - -// TESTCASE NUMBER: 42 -fun case_42(x: MutableMap?) { - return (l@ { - if (false || false || false || x == nullableNothingProperty) return@l - & kotlin.collections.MutableMap?")!>x - & kotlin.collections.MutableMap?")!>x.equals(x) - })() -} - -// TESTCASE NUMBER: 43 -fun case_43(x: Inv>>>>>>?): Any? { - return l@ { - if (x === implicitNullableNothingProperty && true) else { return@l } - >>>>>>? & kotlin.Nothing?")!>x - >>>>>>? & kotlin.Nothing?")!>x.equals(x) - } -} - -// TESTCASE NUMBER: 44 -fun case_44(x: Inv>>>>>>?) { - (l@ { - if (true && true && true && x !== null) else return@l - >>>>>> & Inv>>>>>>?")!>x - >>>>>> & Inv>>>>>>?")!>x.equals(x) - }).invoke() -} - -// TESTCASE NUMBER: 45 -fun case_45(x: T) { - val y = (l@ { - if (x == null) return@l - x - x.equals(x) - })() -} - -// TESTCASE NUMBER: 46 -fun case_46(x: T?) { - (l@ { - if (x === null) return@l - x - x.equals(x) - })() -} - -// TESTCASE NUMBER: 47 -fun case_47(x: Inv?) { - val y = l@ { - if (x !== null) else return@l - & Inv?")!>x - & Inv?")!>x.equals(x) - } -} - -// TESTCASE NUMBER: 48 -fun case_48(x: Inv?, y: Nothing?) { - val y = ((((l@ { - if (x !== y && true) else return@l - & Inv?")!>x - & Inv?")!>x.equals(x) - })))) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.17.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.17.kt deleted file mode 100644 index a4e8cad77a3..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.17.kt +++ /dev/null @@ -1,193 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 17 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality with `null` and `throw` after it) using if expression. - * UNSPECIFIED BEHAVIOR - * HELPERS: objects, properties, classes - */ - -// TESTCASE NUMBER: 1 -fun case_1(x: Int?) { - if (x == null) throw Exception() - x - x.inv() -} - -// TESTCASE NUMBER: 2 -fun case_2(x: Unit?) { - if (x === null) throw Exception() - x - x.equals(x) -} - -// TESTCASE NUMBER: 3 -fun case_3(x: Nothing?) { - if (x != null) else throw Exception() - x -} - -// TESTCASE NUMBER: 4 -fun case_4(x: Number?) { - if (x !== null) else { throw Exception() } - x - x.equals(x) -} - -// TESTCASE NUMBER: 5 -fun case_5(x: Char?, y: Nothing?) { - if (x != y) else throw Exception() - x - x.equals(x) -} - -// TESTCASE NUMBER: 6 -fun case_6(x: Object?) { - if (x !== implicitNullableNothingProperty) else { throw Exception() } - x - x.equals(x) -} - -// TESTCASE NUMBER: 7 -fun case_7(x: Class?) { - if (x === implicitNullableNothingProperty || false || false || false) { throw Exception() } - x - x.equals(x) -} - -// TESTCASE NUMBER: 8 -fun case_8(x: Int?) { - if (false || false || false || x == nullableNothingProperty) throw Exception() - x - x.inv() -} - -// TESTCASE NUMBER: 9 -fun case_9(x: String?) { - if (x != implicitNullableNothingProperty && true && true && true) else { throw Exception() } - x - x.equals(x) -} - -// TESTCASE NUMBER: 10 -fun case_10(x: Float?) { - if (true && true && true && x !== null) else throw Exception() - x - x.equals(x) -} - -// TESTCASE NUMBER: 11 -fun case_11(x: Out<*>?) { - if (x == null) throw Exception() - & Out<*>?")!>x - & Out<*>?")!>x.equals(x) -} - -// TESTCASE NUMBER: 12 -fun case_12(x: Map?) { - if (x === null) throw Exception() - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.equals(x) -} - -// TESTCASE NUMBER: 13 -fun case_13(x: Map?) { - if (x != null) else throw Exception() - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) -} - -// TESTCASE NUMBER: 14 -fun case_14(x: MutableCollection?) { - if (x !== null) else { throw Exception() } - & kotlin.collections.MutableCollection?")!>x - & kotlin.collections.MutableCollection?")!>x.equals(x) -} - -// TESTCASE NUMBER: 15 -fun case_15(x: MutableCollection?, y: Nothing?) { - if (x != y) else throw Exception() - & kotlin.collections.MutableCollection?")!>x - & kotlin.collections.MutableCollection?")!>x.equals(x) -} - -// TESTCASE NUMBER: 16 -fun case_16(x: Collection>>>>>>?) { - if (x !== implicitNullableNothingProperty) else { throw Exception() } - >>>>>> & kotlin.collections.Collection>>>>>>?")!>x - >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.equals(x) -} - -// TESTCASE NUMBER: 17 -fun case_17(x: MutableMap<*, *>?) { - if (x === implicitNullableNothingProperty || false) { throw Exception() } - & kotlin.collections.MutableMap<*, *>?")!>x - & kotlin.collections.MutableMap<*, *>?")!>x.equals(x) -} - -// TESTCASE NUMBER: 18 -fun case_18(x: MutableMap?) { - if (false || false || false || x == nullableNothingProperty) throw Exception() - & kotlin.collections.MutableMap?")!>x - & kotlin.collections.MutableMap?")!>x.equals(x) -} - -// TESTCASE NUMBER: 19 -fun case_19(x: Inv>>>>>>?) { - if (x === implicitNullableNothingProperty && true) else { throw Exception() } - >>>>>>? & kotlin.Nothing?")!>x - >>>>>>? & kotlin.Nothing?")!>x.equals(x) -} - -// TESTCASE NUMBER: 20 -fun case_20(x: Inv>>>>>>?) { - if (true && true && true && x !== null) else throw Exception() - >>>>>> & Inv>>>>>>?")!>x - >>>>>> & Inv>>>>>>?")!>x.equals(x) -} - -// TESTCASE NUMBER: 21 -fun case_21(x: T) { - if (x == null) throw Exception() - x - x.equals(x) -} - -// TESTCASE NUMBER: 22 -fun case_22(x: T?) { - if (x === null) throw Exception() - x - x.equals(x) -} - -// TESTCASE NUMBER: 23 -fun case_23(x: Inv?) { - if (x !== null) else throw Exception() - & Inv?")!>x - & Inv?")!>x.equals(x) -} - -// TESTCASE NUMBER: 24 -fun case_24(x: Inv?, y: Nothing?) { - if (x !== y && true) else throw Exception() - & Inv?")!>x - & Inv?")!>x.equals(x) -} - -// TESTCASE NUMBER: 25 -fun case_25(x: Inv?, y: Nothing?) { - if (x !== y) else try { throw Exception() } finally { throw Exception() } - & Inv?")!>x - & Inv?")!>x.equals(x) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.18.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.18.kt deleted file mode 100644 index 660f985b3df..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.18.kt +++ /dev/null @@ -1,259 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 18 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality with `null` and `break` or `continue` after it) using if expression. - * UNSPECIFIED BEHAVIOR - * HELPERS: objects, properties, classes - */ - -// TESTCASE NUMBER: 1 -fun case_1(x: Int?) { - while (true) { - if (x == null) break - x - x.inv() - } -} - -// TESTCASE NUMBER: 2 -fun case_2(x: Unit?) { - while (true) { - if (x === null) continue - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 3 -fun case_3(x: Nothing?, f: Boolean) { - do { - if (x != null) else break - x.equals(x) - } while (f) -} - -// TESTCASE NUMBER: 4 -fun case_4(x: Number?) { - for (i in 0..10) { - if (x !== null) else { break } - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 5 -fun case_5(x: Char?, y: Nothing?, f: Boolean) { - do { - if (x != y) else continue - x - x.equals(x) - } while (f) -} - -// TESTCASE NUMBER: 6 -fun case_6(x: Object?, f: Boolean) { - while (f) { - if (x !== implicitNullableNothingProperty) else { continue } - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 7 -fun case_7(x: Class?, list: List) { - for (element in list) { - if (x === implicitNullableNothingProperty || false || false || false) { break } - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 8 -fun case_8(x: Int?) { - for (i in 0..10) { - if (false || false || false || x == nullableNothingProperty) continue - x - x.inv() - } -} - -// TESTCASE NUMBER: 9 -fun case_9(list: List) { - for (element in list) { - if (element != implicitNullableNothingProperty && true && true && true) else { break } - element - element.inv() - } -} - -// TESTCASE NUMBER: 10 -fun case_10(x: Float?) { - while (false) { - if (true && true && true && x !== null) else break - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 11 -fun case_11(x: Out<*>?, list: List) { - for (element in list) { - if (x == null) continue - & Out<*>?")!>x - & Out<*>?")!>x.equals(x) - } -} - -// TESTCASE NUMBER: 12 -fun case_12(list: List) { - for (element in list) { - if (element === null) continue - element - element.inv() - } -} - -// TESTCASE NUMBER: 13 -fun case_13(x: Map?) { - do { - if (x != null) else continue - & kotlin.collections.Map?")!>x - & kotlin.collections.Map?")!>x.equals(x) - } while (false) -} - -// TESTCASE NUMBER: 14 -fun case_14(x: MutableCollection?, r: IntRange) { - for (i in r) { - if (x !== null) else { break } - & kotlin.collections.MutableCollection?")!>x - & kotlin.collections.MutableCollection?")!>x.equals(x) - } -} - -// TESTCASE NUMBER: 15 -fun case_15(map: MutableMap, y: Nothing?) { - for ((k, v) in map) { - if (k != y) else break - if (v != y) else continue - k - k.inv() - v - v.inv() - } -} - -// TESTCASE NUMBER: 16 -fun case_16(map: Map) { - for ((k, v) in map) { - if (k !== implicitNullableNothingProperty && v !== implicitNullableNothingProperty) else { continue } - k - k.inv() - v - v.inv() - } -} - -// TESTCASE NUMBER: 17 -fun case_17(x: T?, f: Boolean) { - while (f) { - if (x === implicitNullableNothingProperty || false) { break } - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 18 -fun case_18(x: T, f: Boolean) { - while (f) { - if (false || false || false || x == nullableNothingProperty) break - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 19 -fun case_19(map: MutableMap, y: Nothing?) { - for ((k, v) in map) { - if (k !== implicitNullableNothingProperty && true && v != y) else { break } - k - k.equals(k) - v - v.equals(v) - } -} - -// TESTCASE NUMBER: 20 -fun case_20(map: MutableMap) { - for ((k, v) in map) { - if (true && true && true && k !== null && v != null && true) else continue - k - k.equals(k) - v - v.equals(v) - } -} - -// TESTCASE NUMBER: 21 -fun case_21(map: MutableMap) { - for ((k, v) in map) { - if (k == null) continue - if (v === null || false) break - k - k.equals(k) - v - v.equals(v) - } -} - -// TESTCASE NUMBER: 22 -fun case_22(x: T?) { - while (true) { - if (x === null) break - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 23 -fun case_23(x: Inv?) { - for (i in -10..10) { - if (x !== null) else continue - & Inv?")!>x - & Inv?")!>x.equals(x) - } -} - -// TESTCASE NUMBER: 24 -fun case_24(x: Inv?, y: Nothing?) { - do { - if (x !== y && true) else continue - & Inv?")!>x - & Inv?")!>x.equals(x) - } while (true) -} - -// TESTCASE NUMBER: 25 -fun case_25(x: Inv?, y: Nothing?, z: List) { - for (i in z) { - if (x !== y) else try { - break - } finally { - continue - } - & Inv?")!>x - & Inv?")!>x.equals(x) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.2.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.2.kt deleted file mode 100644 index 83eafe29e7e..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.2.kt +++ /dev/null @@ -1,362 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 2 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality + boolean literals) using if expression and simple types. - * UNSPECIFIED BEHAVIOR - * HELPERS: objects, enumClasses - */ - -// FILE: other_package.kt - -package otherpackage - -// TESTCASE NUMBER: 8, 16 -class Case8_16__1 {} - -// FILE: main.kt - -import otherpackage.* - -// TESTCASE NUMBER: 8, 16 -class Case8_16__2 { - val x: otherpackage.Case8_16__1? - init { - x = otherpackage.Case8_16__1() - } -} - -// TESTCASE NUMBER: 1 -fun case_1(x: Any?) { - if (x != null || false) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 2 -fun case_2(a: DeepObject.A.B.C.D.E.F.G.J?) = - if (false || a != null == true == false == false == false == true == false == true == false == false == true == true || false) { - a.x - a.equals(a) - } else -1 - -/* - * TESTCASE NUMBER: 3 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28328 - */ -fun case_3(b: Boolean) { - val x = { - if (b) object { - val a = 10 - } else null - } - - val y = if (b) x else null - - if (false || false || false || false || y !== null) { - val z = .?")!>y() - case_3..?)?")!>y.equals(y) - - if (z != null || false) { - . & case_3..?"), DEBUG_INFO_SMARTCAST!>z.a - } - } -} - -// TESTCASE NUMBER: 4 -fun case_4(a: ((Float) -> Int?)?, b: Float?) { - if (a != null == true && b != null == true || false || false || false || false || false || false || false || false || false) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.equals(a) - - if (false || x != null == true) { - x - } - } -} - -// TESTCASE NUMBER: 5 -fun case_5(b: Boolean) { - val a = if (b) { - object { - val B5 = if (b) { - object { - val C5 = if (b) { - object { - val D5 = if (b) { - object { - val x: Number? = 10 - } - } else null - } - } else null - } - } else null - } - } else null - - if (a != null && a.B5 != null && a.B5.C5 != null && a.B5.C5.D5 != null && a.B5.C5.D5.x != null && b || false) { - a.B5.C5.D5.x - a.B5.C5.D5.x.equals(a.B5.C5.D5.x) - } -} - -// TESTCASE NUMBER: 6 -fun case_6(z: Boolean?) { - if (false || EnumClassWithNullableProperty.B.prop_1 != null && z != null && z) { - EnumClassWithNullableProperty.B.prop_1 - EnumClassWithNullableProperty.B.prop_1.equals(EnumClassWithNullableProperty.B.prop_1) - } -} - -// TESTCASE NUMBER: 7 -fun case_7(a: DeepObject.A.B.C.D.E.F.G.J?) { - val g = false - - if (a != null && g) { - a - a.equals(a) - } -} - -/* - * TESTCASE NUMBER: 8 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28329 - */ -fun case_8(b: Boolean, c: Boolean?) { - val a = Case8_16__2() - - if (a.x !== null && false) { - if (false || false || false || false || a.x != null || false || false || false) { - if (a.x !== null && true) { - if (a.x != null && b) { - if (a.x != null && b && !b) { - if (a.x != null && c != null && !c) { - if (a.x !== null && c) { - if (a.x != null && b && b && b && b && b && b && b && b && b && b && b) { - if (a.x != null && !b && !b && !b && !b && !b && !b && !b && !b && !b) { - if (a.x !== null && null == null) { - if (a.x != null && null!!) { - if (a.x != null) { - if (a.x != null) { - if (a.x !== null) { - if (a.x != null) { - if (a.x !== null) { - a.x - a.x.equals(a.x) - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} - -// TESTCASE NUMBER: 9 -fun case_9(x: Any?) { - if (x == null || false || false || false || false || false || false) { - - } else { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 10 -fun case_10(a: DeepObject.A.B.C.D.E.F.G.J?) = - if (a == null == true == false == false == false == true == false == true == false == false == true == true && true) { - -1 - } else { - a.x - a.equals(a) - } - -/* - * TESTCASE NUMBER: 11 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28328 - */ -fun case_11(b: Boolean) { - val x = { - if (b) object { - val a = 10 - } else null - } - - val y = if (b) x else null - - if (y === null && true) else { - val z = .?")!>y() - case_11..?)?")!>y.equals(y) - - if (z != null || b) { - - } else { - .? & kotlin.Nothing?")!>z - } - } -} - -// TESTCASE NUMBER: 12 -fun case_12(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { - if (true && a == null == true || b == null == true) { - - } else { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.equals(a) - b.equals(b) - if (x == null == true || (c != null && !c)) { - - } else { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 13 -fun case_13(b: Boolean, c: Boolean, d: Boolean) { - val a = if (b) { - object { - val B19 = if (b) { - object { - val C19 = if (b) { - object { - val D19 = if (b) { - object { - val x: Number? = 10 - } - } else null - } - } else null - } - } else null - } - } else null - - if ((a == null || a.B19 == null || a.B19.C19 == null || a.B19.C19.D19 == null || a.B19.C19.D19.x == null || b || c || !d) && true) { - - } else { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(a.B19.C19.D19.x) - } -} - -/* - * TESTCASE NUMBER: 14 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28329 - */ -fun case_14(z: Boolean?) { - if (true && true && true && true && EnumClassWithNullableProperty.B.prop_1 != null || z != null || z!! && true && true) { - - } else { - EnumClassWithNullableProperty.B.prop_1 - EnumClassWithNullableProperty.B.prop_1.equals(EnumClassWithNullableProperty.B.prop_1) - } -} - -// TESTCASE NUMBER: 15 -fun case_15(a: DeepObject.A.B.C.D.E.F.G.J?) { - val g = false - - if (true && a != null || g || !g || true || !true) { - - } else { - a - a.equals(a) - } -} - -// TESTCASE NUMBER: 16 -fun case_16(b: Boolean, c: Boolean?) { - val a = Case8_16__2() - - if (a.x != null && false && false && false && false && false && false) { - if ( a.x == null || false) { - } else { - if ( a.x === null && true) { - } else { - if (a.x == null || !b) { - } else { - if (a.x == null || b || !b) { - } else { - if (a.x == null || c == null || !c) { - } else { - if (a.x === null || c) { - } else { - if (a.x == null || b || b || b || b || b || b || b || b || b || b || b) { - } else { - if (a.x == null || !b || !b || !b || !b || !b || !b || !b || !b || !b) { - } else { - if (a.x === null || null == null) { - } else { - if (a.x == null || null!!) { - } else { - if (a.x == null) { - } else { - if (a.x == null) { - } else { - if (a.x === null) { - } else { - if (a.x == null) { - } else { - if (a.x === null) { - } else { - a.x - a.x.equals(a.x) - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } - } -} - -// TESTCASE NUMBER: 17 -fun case_17(a: Int?, b: Int = if (a != null) a else 0) { - a - b - b.equals(b) -} - -// TESTCASE NUMBER: 18 -fun case_18(a: Int?, b: Int = if (false || a != null || false) a else 0) { - a - b - b.equals(b) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.6.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.6.kt deleted file mode 100644 index 83ec484c871..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.6.kt +++ /dev/null @@ -1,1009 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 4 -> sentence 2 - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 1 - * paragraph 9 -> sentence 2 - * NUMBER: 6 - * DESCRIPTION: Smartcasts from implicit nullability condition (value or reference equality with `Nothing?` variable) using if expression and simple types. - * UNSPECIFIED BEHAVIOR - * HELPERS: classes, enumClasses, interfaces, objects, typealiases, properties - */ - -// FILE: other_types.kt - -package othertypes - -// TESTCASE NUMBER: 12, 48 -class EmptyClass12_48 {} - -// FILE: main.kt - -import othertypes.* - -// TESTCASE NUMBER: 1 -fun case_1(x: Any?) { - val y = null - if (x != y) { - x - x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 2 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28159 - */ -fun case_2(x: Nothing?) { - val y = null - if (x !== y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 3 -fun case_3() { - val y = null - - if (Object.prop_1 == y) - else { - Object.prop_1 - Object.prop_1.equals(Object.prop_1) - } -} - -// TESTCASE NUMBER: 4 -fun case_4(x: Char?, y: Nothing?) { - if (x != y && true) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 5 -fun case_5() { - val x: Unit? = null - val y: Nothing? = null - - if (x !== y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 6 -fun case_6(x: EmptyClass?, z: Nothing?) { - val y = true - - if (x != z && !y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 7 -fun case_7(x: EmptyObject?) { - val y = null - - if (x != y || x != y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 8 -fun case_8(x: TypealiasNullableString) { - val y = null - - if (x !== y && x != y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 9 -fun case_9(x: TypealiasNullableString?, y: Nothing?) { - if (x === y) { - - } else if (false) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 10 -fun case_10() { - val a = Class() - val b = null - - if (a.prop_4 === b || true) { - if (a.prop_4 != null) { - a.prop_4 - a.prop_4.equals(a.prop_4) - } - } -} - -// TESTCASE NUMBER: 11 -fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) { - val z = null - val u: TypealiasNullableString = null - val v = null - - if (x == z && x == v) { - - } else { - if (y != z) { - if (nullableStringProperty == z) { - if (u != z || u != v) { - x - x.equals(x) - } - } - } - } -} - -// TESTCASE NUMBER: 12 -fun case_12(x: TypealiasNullableString, y: TypealiasNullableString, z1: Nothing?, z2: Nothing?) = & java.io.Serializable}")!>if (x == z1 || x == z2) "1" - else if (y === z1 && y == z2) { - x - x.equals(x) - } else "-1" - -// TESTCASE NUMBER: 13 -fun case_13(x: EmptyClass12_48?, z: Nothing?) = - if (x == z || x === z && x == z) { - throw Exception() - } else { - x - x.equals(x) - } - -// TESTCASE NUMBER: 14 -class Case14 { - val x: TypealiasNullableString? - init { - x = TypealiasNullableString() - } -} - -fun case_14() { - val a = Case14() - val x = null - val y = implicitNullableNothingProperty - - if (a.x != x && a.x != y || a.x != y && a.x !== null) { - a.x - a.x.equals(a.x) - } -} - -// TESTCASE NUMBER: 15 -fun case_15(x: TypealiasNullableString) { - val y = null - val z = & java.io.Serializable}")!>if (x === null || y == x && x === y || null === x) "" else { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 16 -fun case_16() { - val x: TypealiasNullableNothing = null - val y: Nothing? = null - - if (x !== y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 17 -val case_17 = & java.io.Serializable}")!>if (nullableIntProperty === implicitNullableNothingProperty) 0 else { - nullableIntProperty - nullableIntProperty.equals(nullableIntProperty) -} - -//TESTCASE NUMBER: 18 -fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?, b: Boolean) { - val x = null - val y = null - - if (a != (if (b) x else y) || x !== a) { - a - a.equals(a) - } -} - -// TESTCASE NUMBER: 19 -fun case_19(b: Boolean) { - val z = null - val a = if (b) { - object { - val B19 = if (b) { - object { - val C19 = if (b) { - object { - val D19 = if (b) { - object { - val x: Number? = 10 - } - } else z - } - } else z - } - } else z - } - } else z - - if (a != z && a.B19 !== z && a.B19.C19 != z && a.B19.C19.D19 != z && a.B19.C19.D19.x !== z) { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(a.B19.C19.D19.x) - } -} - -// TESTCASE NUMBER: 20 -fun case_20(x: Boolean, y: Nothing?) { - val z = object { - val B19 = object { - val C19 = object { - val D19 = if (x) { - object {} - } else y - } - } - } - - if (z.B19.C19.D19 !== y) { - .B19..C19..D19. & case_20..B19..C19..D19.?")!>z.B19.C19.D19 - .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>z.B19.C19.D19.equals(z.B19.C19.D19) - } -} - -// TESTCASE NUMBER: 21 -fun case_21() { - if (EnumClassWithNullableProperty.A.prop_1 !== implicitNullableNothingProperty) { - EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(EnumClassWithNullableProperty.A.prop_1) - } -} - -// TESTCASE NUMBER: 22 -fun case_22(a: (() -> Unit)?) { - if (a != implicitNullableNothingProperty) { - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a() - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(a) - } -} - -// TESTCASE NUMBER: 23 -fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { - if (a != z && b !== z && b !== z) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (x != z || x !== implicitNullableNothingProperty) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 24 -fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) = - if (a !== z && b !== z) { - kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a( kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b) - kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(a) - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.equals(a) - } else z - -// TESTCASE NUMBER: 25 -fun case_25(b: Boolean, z: Nothing?) { - val x = { - if (b) object { - val a = 10 - } else z - } - - val y = if (b) x else z - - if (y !== z || y != implicitNullableNothingProperty) { - val z1 = .?")!> case_25..?)? & () -> case_25..?"), DEBUG_INFO_SMARTCAST!>y() - - if (z1 != z && implicitNullableNothingProperty !== z1) { - . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.a - . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.equals(z1) - } - } -} - -// TESTCASE NUMBER: 26 -fun case_26(a: ((Float) -> Int?)?, b: Float?) { - var z = null - - if (a != z == true && b != implicitNullableNothingProperty == true) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (x != implicitNullableNothingProperty == true || z !== x) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 27 -fun case_27(z: Nothing?) { - if (Object.prop_1 == z == true == true == true == true == true == true == true == true == true == true == true == true == true == true) - else { - Object.prop_1 - Object.prop_1.equals(Object.prop_1) - } -} - -// TESTCASE NUMBER: 28 -fun case_28(a: DeepObject.A.B.C.D.E.F.G.J?) = - if (a != implicitNullableNothingProperty == true == false == false == false == true == false == true == false == false == true == true) { - a.x - a.equals(a) - } else -1 - -/* - * TESTCASE NUMBER: 29 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28328, KT-28329 - */ -fun case_29(x: Boolean) { - val v = null - val z = { - if (x) object { - val a = 10 - } else null - } - - val y = if (x) z else null - - if (false || false || false || false || y !== v) { - val t = .?")!>y() - - if (z !== t || false) { - .?")!>t.a - .?")!>t.equals(t) - } - } -} - -// TESTCASE NUMBER: 30 -fun case_30(a: ((Float) -> Int?)?, b: Float?) { - if (implicitNullableNothingProperty != a == true && b != implicitNullableNothingProperty == true || false || false || false || false || false || false || false || false || false) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (false || implicitNullableNothingProperty != x == true) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 31 -fun case_31(z1: Boolean?, z: Nothing?) { - if (false || EnumClassWithNullableProperty.A.prop_1 != z && z1 !== z && z1) { - EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(EnumClassWithNullableProperty.A.prop_1) - } -} - -// TESTCASE NUMBER: 32 -fun case_32(a: DeepObject.A.B.C.D.E.F.G.J?) = - if (a == implicitNullableNothingProperty == true == false == false == false == true == false == true == false == false == true == true && true) { - -1 - } else { - a.x - a.equals(a) - } - -// TESTCASE NUMBER: 33 -fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { - var z = null - - if (true && a == z == true || b == null == true) { - - } else { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (x == z == true && x === z || (c != z && !c)) { - - } else { - x - x.equals(x) - } - } -} - -/* - * TESTCASE NUMBER: 34 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28329 - */ -fun case_34(z1: Boolean?) { - var z = null - - if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && EnumClassWithNullableProperty.A.prop_1 !== null && EnumClassWithNullableProperty.A.prop_1 !== z || z1 != implicitNullableNothingProperty || z1!! && true && true) { - - } else { - EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(EnumClassWithNullableProperty.A.prop_1) - } -} - -// TESTCASE NUMBER: 35 -fun case_35(a: DeepObject.A.B.C.D.E.F.G.J?) { - val itest = false - - if (true && a != implicitNullableNothingProperty && a !== implicitNullableNothingProperty || itest || !itest || true || !true) { - - } else { - a - a.equals(a) - } -} - -// TESTCASE NUMBER: 36 -fun case_36(x: Any) { - var z = null - - if (x == z) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 37 -fun case_37(x: Nothing?, y: Nothing?) { - if (x == y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 38 -fun case_38() { - val z = null - - if (Object.prop_2 != z) - else { - Object.prop_2 - Object.prop_2.equals(Object.prop_2) - } -} - -// TESTCASE NUMBER: 39 -fun case_39(x: Char?) { - if (x == implicitNullableNothingProperty && true) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 40 -fun case_40() { - val x: Unit? = null - var z = null - - if (x == implicitNullableNothingProperty || z === x) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 41 -fun case_41(x: EmptyClass?, z: Nothing?) { - val y = true - - if (x === z && !y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 42 -fun case_42() { - if (EmptyObject == nullableNothingProperty || EmptyObject === nullableNothingProperty) { - EmptyObject - EmptyObject.equals(EmptyObject) - } -} - -// TESTCASE NUMBER: 43 -fun case_43(x: TypealiasNullableString) { - val z = null - - if (x == z && x == z) { - x - x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 44 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28329 - */ -fun case_44(x: TypealiasNullableString?, z1: Nothing?) { - if (true && true && true && true && x !== z1) { - - } else if (false) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 45 -fun case_45() { - val a = Class() - var z: Nothing? = null - - if (a.prop_4 != z || true) { - if (a.prop_4 == null) { - a.prop_4 - a.prop_4.equals(a.prop_4) - } - } -} - -// TESTCASE NUMBER: 46 -fun case_46(x: TypealiasNullableString?, y: TypealiasNullableString) { - val t: TypealiasNullableString = null - var z: Nothing? = null - - if (x != nullableNothingProperty) { - - } else { - if (y === nullableNothingProperty) { - if (z != nullableStringProperty) { - if (z === t || t == nullableNothingProperty) { - x - x.equals(x) - } - } - } - } -} - -/* - * TESTCASE NUMBER: 47 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28328 - */ -fun case_47(x: TypealiasNullableString, y: TypealiasNullableString, z: Nothing?) = & java.io.Serializable}")!>if (x !== z && true && true && true) "1" - else if (y != z) { - x - x.equals(x) - } else "-1" - -// TESTCASE NUMBER: 48 -fun case_48(x: EmptyClass12_48?, z: Nothing?) = - if (x != z && true) { - throw Exception() - } else { - x - x.equals(x) - } - -// TESTCASE NUMBER: 49 -class Case49 { - val x: TypealiasNullableString? - init { - x = TypealiasNullableString() - } -} - -fun case_49() { - val a = Case49() - var z = null - - if (a.x === z) { - a.x - a.x.equals(a.x) - } -} - -// TESTCASE NUMBER: 50 -fun case_50(x: TypealiasNullableString) { - val z1 = null - val z2 = null - val t = & java.io.Serializable}")!>if (x != z1 && z2 !== x) "" else { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 51 -fun case_51() { - val x: TypealiasNullableNothing = null - val z: Nothing? = null - - if (x === z || z == x && x == z || false || false || false) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 52 -val case_52 = & java.io.Serializable}")!>if (nullableIntProperty !== nullableNothingProperty && nullableNothingProperty != nullableIntProperty) 0 else { - nullableIntProperty - nullableIntProperty.equals(nullableIntProperty) -} - -//TESTCASE NUMBER: 53 -fun case_53(a: DeepObject.A.B.C.D.E.F.G.J?) { - if (a == DeepObject.prop_2) { - a - a.equals(a) - } -} - -// TESTCASE NUMBER: 54 -fun case_54(b: Boolean) { - val a = if (b) { - object { - var z = null - val B54 = if (b) { - object { - val C54 = if (b) { - object { - val D54 = if (b) { - object { - val x: Number? = 10 - } - } else null - } - } else null - } - } else null - } - } else null - - val z = null - - if (a != z && a.B54 !== a.z && a.B54.C54 != a.z && a.B54.C54.D54 != a.z && a.B54.C54.D54.x === a.z) { - a.B54.C54.D54.x - a.B54.C54.D54.x.equals(a.B54.C54.D54.x) - } -} - -// TESTCASE NUMBER: 55 -fun case_55(b: Boolean) { - val a = object { - val B19 = object { - val C19 = object { - var z = null - val D19 = if (b) { - object {} - } else null - } - } - } - - if (a.B19.C19.D19 === a.B19.C19.z) { - .B19..C19..D19.? & kotlin.Nothing?")!>a.B19.C19.D19 - } -} - -// TESTCASE NUMBER: 56 -fun case_56() { - if (EnumClassWithNullableProperty.A.prop_1 == implicitNullableNothingProperty) { - EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(EnumClassWithNullableProperty.A.prop_1) - } -} - -// TESTCASE NUMBER: 57 -fun case_57(a: (() -> Unit)) { - var z = null - - if (a == z) { - kotlin.Unit & kotlin.Nothing")!>a - kotlin.Unit & kotlin.Nothing")!>a.equals(a) - } -} - -// TESTCASE NUMBER: 58 -fun case_58(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { - if (a === z && b == z || z == a && z === b) { - kotlin.Int?)? & kotlin.Nothing?")!>a - b - if (a != z) { - kotlin.Int?)? & (kotlin.Float) -> kotlin.Int? & kotlin.Nothing")!>a - kotlin.Int?)? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>a.equals(a) - } - } -} - -/* - * TESTCASE NUMBER: 59 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28329 - */ -fun case_59(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) { - if (false || false || a == z && b === z) { - kotlin.Unit) -> kotlin.Unit)?")!>a - kotlin.Unit)?")!>b - kotlin.Unit) -> kotlin.Unit)?")!>a.equals(a) - kotlin.Unit)?")!>b.equals(b) - } -} - -// TESTCASE NUMBER: 60 -fun case_60(b: Boolean) { - val x = { - if (b) object { - val a = 10 - } else nullableNothingProperty - } - - val y = if (b) x else nullableNothingProperty - - if (y != nullableNothingProperty) { - val z = .?")!> case_60..?)? & () -> case_60..?"), DEBUG_INFO_SMARTCAST!>y() - - if (z == nullableNothingProperty) { - .? & kotlin.Nothing?")!>z - } - } -} - -// TESTCASE NUMBER: 61 -fun case_61(x: Any?) { - if (x is Number?) { - if (x !== implicitNullableNothingProperty) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 62 -fun case_62(x: Any?) { - var z = null - if (x is Number? && x is Int? && x != z) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 63 -fun case_63(x: Any?, b: Boolean) { - val z1 = null - val z2 = null - val z3 = null - - if (x is Number?) { - if (x !== when (b) { true -> z1; false -> z2; else -> z3 }) { - if (x is Int?) { - x - x.equals(x) - } - } - } -} - -// TESTCASE NUMBER: 64 -fun case_64(x: Any?) { - if (x != try {implicitNullableNothingProperty} finally {}) { - if (x is Number) { - if (x is Int?) { - x - x.equals(x) - } - } - } -} - -// TESTCASE NUMBER: 65 -fun case_65(x: Any?, z: Nothing?) { - if (x is ClassLevel1?) { - if (x is ClassLevel2?) { - if (x is ClassLevel3?) { - if (x is ClassLevel4?) { - if (x is ClassLevel5?) { - if (x != z) { - x - x.equals(x) - } - } - } - } - } - } -} - -// TESTCASE NUMBER: 66 -fun case_66(x: Any?, z1: Nothing?, z2: Nothing?, b: Boolean) { - if (x is ClassLevel1?) { - if (x is ClassLevel2?) { - if (x is ClassLevel3?) { - if (x != if (b) { z1 } else { z2 } && x is ClassLevel4?) { - if (x is ClassLevel5?) { - x - x.equals(x) - } - } - } - } - } -} - -// TESTCASE NUMBER: 67 -fun case_67(x: Any?) { - var z = null - - if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { - if (x is ClassLevel4? && x != (fun (): Nothing? { return z })() && x is ClassLevel5?) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 68 -fun case_68(x: Any?, z: Nothing?) { - if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { - if (x is ClassLevel4? && x != (fun (): Nothing? { return z })() && x is ClassLevel5?) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 69 -fun case_69(x: Any?, z: Nothing?) { - if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3? && x is ClassLevel4? && x != try { z } catch (e: Exception) { z } && x is ClassLevel5?) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 70 -fun case_70(x: Any?) { - if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { - if (x is ClassLevel4?) { - - } else if (x is ClassLevel5? && x != nullableNothingProperty || x != implicitNullableNothingProperty) { - x - x.equals(x) - } - } else if (x is ClassLevel4? && x !== nullableNothingProperty && x is ClassLevel5?) { - x - x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 71 - * NOTE: lazy smartcasts - * DISCUSSION - * ISSUES: KT-28362 - */ -fun case_71(t: Any?) { - val z1 = null - var z2 = z1 - - if (t is Interface1?) { - if (t is Interface2?) { - if (t != z2) { - t - t.itest1() - t.itest2() - t.itest() - - t.let { it.itest1(); it.itest2() } - } - } - } -} - -/* - * TESTCASE NUMBER: 72 - * NOTE: lazy smartcasts - * DISCUSSION - * ISSUES: KT-28362, KT-27032 - */ -fun case_72(t: Any?, z1: Nothing?) { - var z2 = null - - if (t is Interface1? && t != z1 ?: z2 && t is Interface2?) { - t - t.itest1() - t.itest2() - t.itest() - - t.let { it.itest1(); it.itest2() } - } -} - -/* - * TESTCASE NUMBER: 73 - * NOTE: lazy smartcasts - * DISCUSSION - * ISSUES: KT-28362 - */ -fun case_73(t: Any?) { - val `null` = null - - if (t is Interface2?) { - if (t is ClassLevel1?) { - if (t is ClassLevel2? && t is Interface1?) { - if (t !is Interface3?) {} else if (false) { - if (t != `null`) { - t.itest2() - t.itest1() - t.itest() - t.test1() - t.test2() - t - } - } - } - } - } -} - -/* - * TESTCASE NUMBER: 74 - * NOTE: lazy smartcasts - * DISCUSSION - * ISSUES: KT-28362 - */ -fun case_74(t: Any?) { - if (t is Interface2?) { - if (t is ClassLevel1?) { - if (t == implicitNullableNothingProperty || t === implicitNullableNothingProperty || t !is Interface1?) else { - if (t is ClassLevel2?) { - if (t is Interface3?) { - t.itest2() - t.itest1() - t.itest() - t.test1() - t.test2() - t - } - } - } - } - } -} - -/* - * TESTCASE NUMBER: 75 - * NOTE: lazy smartcasts - * DISCUSSION - * ISSUES: KT-28362 - */ -fun case_75(t: Any?, z: Nothing?) { - if (t !is ClassLevel2? || t !is ClassLevel1?) else { - if (t === ((((((z)))))) || t !is Interface1?) else { - if (t !is Interface2? || t !is Interface3?) {} else { - t.itest2() - t.itest1() - t.itest() - t.test1() - t.test2() - t - } - } - } -} - -// TESTCASE NUMBER: 76 -fun case_76(a: Any?, b: Int = if (a !is Number? === true || a !is Int? == true || a != null == false == true) 0 else a) { - a - b - b.equals(b) -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.7.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.7.kt deleted file mode 100644 index ea73ed5b10b..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.7.kt +++ /dev/null @@ -1,354 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * NUMBER: 7 - * DESCRIPTION: Multi smartcasts - * UNEXPECTED BEHAVIOUR - * HELPERS: classes, enumClasses, objects, typealiases, properties - */ - -// FILE: other_package.kt - -package orherpackage - -// TESTCASE NUMBER: 13 -class EmptyClass13 {} - -// TESTCASE NUMBER: 14 -typealias TypealiasString14 = String? - -// FILE: main.kt - -import orherpackage.* - -// TESTCASE NUMBER: 1 -fun case_1(x: Any?) { - if (x != null || x != null || x != null || x != null || x != null || x != null || x != null) { - x - x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 2 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28159 - */ -fun case_2(x: Nothing?) { - if (x !== null && x !== null) { - x - } -} - -// TESTCASE NUMBER: 3 -fun case_3() { - if (Object.prop_1 == null && Object.prop_1 == null) - else { - Object.prop_1 - Object.prop_1.equals(Object.prop_1) - } -} - -// TESTCASE NUMBER: 4 -fun case_4(x: Char?) { - if (x != null && true || x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 5 -fun case_5() { - val x: Unit? = null - - if (x !== null || x !== null && x !== null || x !== null && x !== null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 6 -fun case_6(x: Class?) { - val y = true - - if (((false || x != null || false) && !y) || x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 7 -fun case_7() { - val x: EmptyObject? = null - if (x != null || x != null || x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 8 -fun case_8(x: TypealiasString) { - if (x !== null && x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 9 -fun case_9(x: TypealiasNullableString?) { - if (x === null && x === null || x === null) { - - } else if (x === null || x === null) { - } else if (false) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 10 -fun case_10() { - val a = Class() - - if (a.prop_4 === null || a.prop_4 === null || true) { - if (a.prop_4 != null) { - a.prop_4 - a.prop_4.equals(a.prop_4) - } - } -} - -// TESTCASE NUMBER: 11 -fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) { - val t: TypealiasNullableString = null - - if (x == null) { - - } else { - if (x != null) { - if (y != null || y != null) { - if (stringProperty == null && nullableNothingProperty == null) { - if (t != null || t != null) { - x - x.equals(x) - } - } - } - } - } -} - -// TESTCASE NUMBER: 12 -fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = if (x == null) "1" - else if (y === null || y === null) { - x.equals(x) - x - } else "-1" - -// TESTCASE NUMBER: 13 -fun case_13(x: orherpackage.EmptyClass13?, y: Nothing?) = - if (x == null || x === y) { - throw Exception() - } else { - x.equals(x) - x - } - -// TESTCASE NUMBER: 14 -fun case_14() { - val a = Class() - if (a.prop_6 != a.prop_7) { - a.prop_6 - a.prop_6.equals(a.prop_6) - } -} - -// TESTCASE NUMBER: 15 -fun case_15(x: TypealiasString?) { - var y = null - val t = if (x === null || x == y && x === y) "" else { - x.equals(x) - x - } -} - -// TESTCASE NUMBER: 16 -fun case_16() { - val x: TypealiasNothing? = null - val y: Nothing? = null - - if (x != null || x !== null || x != y) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 17 -val case_17 = if (nullableIntProperty == null || nullableNothingProperty === nullableIntProperty) 0 else { - nullableIntProperty.equals(nullableIntProperty) - nullableIntProperty -} - -/* - * TESTCASE NUMBER: 18 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28328 - */ -fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?, b: Nothing?) { - if (a != null || b !== a || false) { - a - a.equals(a) - } -} - -// TESTCASE NUMBER: 19 -fun case_19(b: Boolean) { - val a = if (b) { - object { - var y = null - val B19 = if (b) { - object { - val C19 = if (b) { - object { - val D19 = if (b) { - object { - val x: Number? = 10 - } - } else null - } - } else null - } - } else null - } - } else null - - if (a != null && a.B19 != a.y && a.B19.C19 != a.y && a.B19.C19.D19 != a.y && a.B19.C19.D19.x != a.y) { - a.B19.C19.D19.x - a.B19.C19.D19.x.equals(a.B19.C19.D19.x) - } -} - -// TESTCASE NUMBER: 20 -fun case_20(b: Boolean) { - val a = object { - val y = null - val B19 = object { - val C19 = object { - val D19 = if (b) { - object {} - } else null - } - } - } - - if (a.B19.C19.D19 !== null || a.y != a.B19.C19.D19) { - .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19 - .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.equals(a.B19.C19.D19) - } -} - -// TESTCASE NUMBER: 21 -fun case_21() { - val y = null - if (EnumClassWithNullableProperty.A.prop_1 !== null && y != EnumClassWithNullableProperty.A.prop_1) { - EnumClassWithNullableProperty.A.prop_1 - EnumClassWithNullableProperty.A.prop_1.equals(EnumClassWithNullableProperty.A.prop_1) - } -} - -// TESTCASE NUMBER: 22 -fun case_22(a: (() -> Unit)?) { - var y = null - if (a != null || y != a) { - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a() - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(a) - } -} - -// TESTCASE NUMBER: 23 -fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) { - if (a != null && b !== null || a != c && b !== c) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (x != null || c !== x) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 24 -fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = - if (a !== null && b !== null || implicitNullableNothingProperty != a && nullableNothingProperty !== b) { - kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a( kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b) - kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(a) - kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.equals(b) - } else null - -// TESTCASE NUMBER: 25 -fun case_25(b: Boolean) { - val x = { - if (b) object { - val a = 10 - val b = null - } else null - } - - val y = if (b) x else null - - if (y !== null || x()!!.b != y) { - if (x()!!.b != y) { - val z = .?")!> case_25..?)? & () -> case_25..?"), DEBUG_INFO_SMARTCAST!>y() - - if (z != null) { - . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a - . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.equals(z) - } - } - } -} - -// TESTCASE NUMBER: 26 -fun case_26(a: ((Float) -> Int?)?, b: Float?) { - var c: Nothing? = null - - if (a != null == true && b != null == true || c != a == true && b != c == true) { - val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) - if (x != null == true) { - x - x.equals(x) - } - } -} - -// TESTCASE NUMBER: 27 -fun case_27(y: Nothing?) { - if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true || y == Object.prop_1 == true == true == true == false == false) - else { - Object.prop_1 - Object.prop_1.equals(Object.prop_1) - } -} - -//TESTCASE NUMBER: 28 -fun case_28(a: DeepObject.A.B.C.D.E.F.G.J?) = - if (a != null == true == false == false == false == true == false == true == false == false == true == true && a.x !== nullableNothingProperty) { - a.x - a.equals(a) - } else -1 - -// TESTCASE NUMBER: 29 -fun case_29(a: Int?, b: Nothing?, c: Int = if (a === b) 0 else a) { - a - b -} - -// TESTCASE NUMBER: 30 -fun case_30(a: Int?, b: Nothing?, c: Int = if (a === b || a == null) 0 else a) { - a - b -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.8.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.8.kt deleted file mode 100644 index dd794ef7270..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.8.kt +++ /dev/null @@ -1,128 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 8 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) using if expression and generic types. - * HELPERS: properties, classes - */ - -// TESTCASE NUMBER: 1 -fun case_1(x: Inv?) { - if (x != null) { - & Inv?")!>x - & Inv?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - } -} - -// TESTCASE NUMBER: 2 -fun case_2(a: Inv?>?>?>?>?>?) { - if (a != null) { - val b = ?>?>?>?>?> & Inv?>?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>a.get() - if (b != null) { - val c = ?>?>?>?> & Inv?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>b.get() - if (c != null) { - val d = ?>?>?> & Inv?>?>?>?"), DEBUG_INFO_SMARTCAST!>c.get() - if (d != null) { - val e = ?>?> & Inv?>?>?"), DEBUG_INFO_SMARTCAST!>d.get() - if (e != null) { - val f = ?> & Inv?>?"), DEBUG_INFO_SMARTCAST!>e.get() - if (f != null) { - val g = & Inv?"), DEBUG_INFO_SMARTCAST!>f.get() - if (g != null) { - g - g.equals(g) - } - } - } - } - } - } - } -} - -// TESTCASE NUMBER: 3 -fun case_3(a: Inv?) { - if (a != null) { - val b = a - if (a == null) { - & Inv?")!>b - & Inv?"), DEBUG_INFO_SMARTCAST!>b.equals(b) - } - } -} - -// TESTCASE NUMBER: 4 -fun case_4(a: Inv?, b: Inv = if (a != null) & Inv?"), DEBUG_INFO_SMARTCAST!>a else Inv()) { - ?")!>a - ")!>b - ")!>b.equals(b) -} - -// TESTCASE NUMBER: 5 -fun case_5() { - if (nullableOut != null) { - & Out?")!>nullableOut - & Out?"), DEBUG_INFO_SMARTCAST!>nullableOut.equals(nullableOut) - } -} - -// TESTCASE NUMBER: 6 -fun case_6() { - val x: Inv? = null - - if (x != null) { - & Inv?")!>x - & Inv?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - } -} - -// TESTCASE NUMBER: 7 -fun case_7() { - var x: Inv? = null - - if (x != null) { - & Inv?")!>x - & Inv?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - } -} - -// TESTCASE NUMBER: 8 -fun case_8(x: ClassWithThreeTypeParameters?>?) { - if (x != null) { - ?> & ClassWithThreeTypeParameters?>?")!>x - ?> & ClassWithThreeTypeParameters?>?"), DEBUG_INFO_SMARTCAST!>x.equals(x) - if (x.x != null) { - x.x - x.x.equals(x.x) - } - if (x.y != null) { - x.y - x.y.equals(x.y) - } - if (x.z != null) { - & ClassWithThreeTypeParameters?")!>x.z - "), DEBUG_INFO_SMARTCAST!>x.z.equals(x.z) - if (x.z.x != null) { - x.z.x - x.z.x.equals(x.z.x) - } - if (x.z.y != null && x.z.z != null) { - x.z.y - x.z.y.equals(x.z.y) - x.z.z - x.z.z.equals(x.z.z) - } - } - } -} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.9.kt b/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.9.kt deleted file mode 100644 index 75596cba92f..00000000000 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.9.kt +++ /dev/null @@ -1,427 +0,0 @@ -// !LANGUAGE: +NewInference -// !DIAGNOSTICS: -UNUSED_EXPRESSION -// SKIP_TXT - -/* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) - * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 - * NUMBER: 9 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) using if expression and generic types with projections. - * HELPERS: classes - */ - -// TESTCASE NUMBER: 1 -fun case_1(x: Out<out Int?>?) { - if (x != null) { - & Out?")!>x - & Out?")!>x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 2 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28598 - */ -fun case_2(a: Out<out Out<out Out<out Out<out Out<out Out<out Int?>?>?>?>?>?>?) { - if (a != null) { - val b = ?>?>?>?>?> & Out?>?>?>?>?>?")!>a.get() - if (b != null) { - val c = ?>?>?>?> & Out?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>b.get() - if (c != null) { - val d = ?>?>?> & Out?>?>?>?"), DEBUG_INFO_SMARTCAST!>c.get() - if (d != null) { - val e = ?>?> & Out?>?>?"), DEBUG_INFO_SMARTCAST!>d.get() - if (e != null) { - val f = ?> & Out?>?"), DEBUG_INFO_SMARTCAST!>e.get() - if (f != null) { - val g = & Out?"), DEBUG_INFO_SMARTCAST!>f.get() - if (g != null) { - g - g.equals(g) - } - } - } - } - } - } - } -} - -// TESTCASE NUMBER: 3 -fun case_3(a: Inv?) { - if (a != null) { - val b = a - if (a == null) - & Inv?")!>b - & Inv?")!>b.equals(b) - } -} - -// TESTCASE NUMBER: 4 -fun case_4(a: Out<out Int>?, b: Out<out Int> = if (a != null) & Out?"), DEBUG_INFO_SMARTCAST!>a else Out()) { - ?")!>a - ")!>b - ")!>b.equals(b) -} - -// TESTCASE NUMBER: 5 -val x: Out<out Int>? = null - -fun case_5() { - if (x != null) { - & Out?")!>x - & Out?")!>x.equals(x) - } -} - -// TESTCASE NUMBER: 6 -fun case_6() { - val x: Inv? = null - - if (x != null) { - & Inv?")!>x - & Inv?")!>x.equals(x) - } -} - -// TESTCASE NUMBER: 7 -fun case_7() { - var x: Out<out Int>? = null - - if (x != null) { - & Out?")!>x - & Out?")!>x.equals(x) - } -} - -/* - * TESTCASE NUMBER: 8 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-25432 - */ -fun case_8(x: ClassWithThreeTypeParameters?>?) { - if (x != null) { - ?> & ClassWithThreeTypeParameters?>?")!>x - ?> & ClassWithThreeTypeParameters?>?")!>x.equals(x) - if (x.x != null) { - x.x - x.x.equals(x.x) - } - if (x.y != null) { - x.y - x.y.equals(x.y) - } - if (x.z != null) { - ?")!>x.z - ?")!>x.z.equals(x.z) - if (x.z.x != null) { - x.z.x - x.z.x.equals(x.z.x) - } - if (x.z.y != null && x.z.z != null) { - x.z.y - x.z.z - x.z.y.equals(x.z.y) - x.z.z.equals(x.z.z) - } - } - } -} - -// TESTCASE NUMBER: 9 -fun case_9(a: (Inv) -> Inv?, b: Inv?) { - if (b != null) { - val c = a(b) - if (c != null) { - & Inv?")!>c - & Inv?")!>c.equals(c) - } - } -} - -// TESTCASE NUMBER: 10 -fun case_9(a: Inv<*>?) { - if (a != null) { - & Inv<*>?")!>a - & Inv<*>?")!>a.equals(a) - } -} - -// TESTCASE NUMBER: 11 -fun case_10() { - val a10: Out<*>? = null - - if (a10 != null) { - & Out<*>?")!>a10 - & Out<*>?")!>a10.equals(a10) - } -} - -// TESTCASE NUMBER: 12 -fun case_11() { - val a: In<*>? = null - - if (a != null) { - & In<*>?")!>a - & In<*>?")!>a.equals(a) - } -} - -// TESTCASE NUMBER: 13 -fun case_13(a: ClassWithSixTypeParameters<*, *, *, *, *, *>?) { - if (a != null) { - & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a - & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.equals(a) - } -} - -// TESTCASE NUMBER: 14 -fun case_14(a: ClassWithSixTypeParameters<*, Int, *, Out<*>, *, Map>>?) { - if (a != null) { - , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a - , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.equals(a) - } -} - -// TESTCASE NUMBER: 15 -fun case_15(a: Any?) { - if (a is ClassWithSixTypeParameters<*, *, *, *, *, *>?) { - if (a != null) { - a - & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.equals(a) - } - } -} - -// TESTCASE NUMBER: 16 -fun case_16(a: Any?) { - if (a === null) { - } else { - if (a !is ClassWithSixTypeParameters<*, *, *, *, *, *>?) { - } else { - & kotlin.Any & kotlin.Any?")!>a - & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.equals(a) - } - } -} - -/* - * TESTCASE NUMBER: 17 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28598 - */ -fun case_17(a: Inv?>?>?>?>?>?) { - if (a != null) { - val b = ?>?>?>?>?> & Inv?>?>?>?>?>?")!>a.get() - if (b != null) { - val c = ?>?>?>?> & Out?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>b.get() - if (c != null) { - val d = ?>?>?> & Out?>?>?>?"), DEBUG_INFO_SMARTCAST!>c.get() - if (d != null) { - val e = ?>?> & Out?>?>?"), DEBUG_INFO_SMARTCAST!>d.get() - if (e != null) { - val f = ?> & Out?>?"), DEBUG_INFO_SMARTCAST!>e.get() - if (f != null) { - val g = & Out?"), DEBUG_INFO_SMARTCAST!>f.get() - if (g != null) { - g - g.equals(g) - } - } - } - } - } - } - } -} - -/* - * TESTCASE NUMBER: 18 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_18(a: Inv) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 19 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_19(a: Inv) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 20 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_20(a: Inv) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 21 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_21(a: Out<out Int?>) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 22 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_22(a: Out<out Nothing?>) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 23 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_23(a: Out<out Any?>) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -// TESTCASE NUMBER: 24 -fun case_24(a: Out) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -// TESTCASE NUMBER: 25 -fun case_25(a: Out) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -// TESTCASE NUMBER: 26 -fun case_26(a: Out) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 27 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_27(a: Inv) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 28 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_28(a: Inv) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -/* - * TESTCASE NUMBER: 29 - * UNEXPECTED BEHAVIOUR - * ISSUES: KT-28785 - */ -fun case_29(a: Inv) { - if (a.x != null) { - a.x - a.x.equals(a.x) - } -} - -// TESTCASE NUMBER: 30 -fun case_30() { - val a = In() - val b = a.getWithUpperBoundT() - - if (b != null) { - b - b.equals(b) - } -} - -// TESTCASE NUMBER: 31 -fun case_31(y: Inv) { - val x = y.get() - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 32 -fun case_32(y: Inv) { - val x = y.getNullable() - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 33 -fun case_33(y: Inv) { - val x = y.getNullable() - - if (x != null) { - x - x.equals(x) - } -} - -// TESTCASE NUMBER: 34 -fun case_34(y: Inv) { - val x = y.getNullable() - - if (x != null) { - x - x.equals(x) - } -} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt index 54c214481bd..b0fcc76eeb8 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/common/neg/14.txt @@ -13,7 +13,12 @@ public fun expandInv(/*0*/ vararg x: [ERROR : Inv] /*kotlin.Arra public fun expandInvWithRemoveNullable(/*0*/ vararg x: [ERROR : Inv] /*kotlin.Array]>*/): K public fun expandOut(/*0*/ vararg x: [ERROR : Out] /*kotlin.Array]>*/): K public fun expandOutWithRemoveNullable(/*0*/ vararg x: [ERROR : Out] /*kotlin.Array]>*/): K +public fun funNothingQuest(): kotlin.Nothing? public fun funWithAnyArg(/*0*/ value_1: kotlin.Any): kotlin.Int public fun funWithoutArgs(): kotlin.Int public fun removeNullable(/*0*/ vararg x: K? /*kotlin.Array*/): K public fun select(/*0*/ vararg x: K /*kotlin.Array*/): K +public fun kotlin.Any.funAny(): kotlin.Int +public fun kotlin.Any?.funNullableAny(): kotlin.Int +public fun T?.funNullableT(): kotlin.Int +public fun T.funT(): kotlin.Int diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt index e8cf9b57838..58b7a50fc08 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/neg/3.txt @@ -54,6 +54,7 @@ public object DeepObject { public object J { private constructor J() + public final val prop_1: kotlin.Int? = 10 public final val x: kotlin.Int? = 10 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt index fd9eb18191a..833acec3170 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/1.txt @@ -36,15 +36,28 @@ public fun T?.case_8(): kotlin.Unit public fun T.case_9(): kotlin.Boolean? Returns(NULL) -> is Byte? +public operator fun Class?.dec(): Class? +public operator fun Class?.inc(): Class? +public operator fun Class?.minus(/*0*/ x: Class?): Class? +public operator fun Class?.plus(/*0*/ x: Class?): Class? + public final class Class { public constructor Class() public final val prop_1: kotlin.Int = 1 + public final val prop_10: kotlin.Number? = 3.0.toFloat() + public final val prop_11: kotlin.Int = 10 + public final var prop_12: kotlin.String + public final val prop_13: kotlin.Any? = "" + public final val prop_14: kotlin.Comparable<*>? = "" + public final val prop_15: kotlin.collections.Iterable<*>? = "" public final val prop_2: kotlin.Int = 2 public final val prop_3: kotlin.Int = 3 public final val prop_4: kotlin.Float? = 3.0.toFloat() public final val prop_5: kotlin.Float = 3.0.toFloat() public final val prop_6: kotlin.String = "..." - public final val prop_7: kotlin.Nothing? = "..." + public final val prop_7: kotlin.Nothing? = null + public final val prop_8: Class? = null + public final var prop_9: kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Char): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Int): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Long): kotlin.Boolean @@ -52,14 +65,22 @@ public final class Class { public final fun fun_1(): (kotlin.Int) -> (kotlin.Int) -> kotlin.Int public final fun fun_2(/*0*/ value_1: kotlin.Int): kotlin.Int public final fun fun_3(/*0*/ value_1: kotlin.Int): (kotlin.Int) -> kotlin.Int + public final fun fun_4(): Class? + public final operator fun get(/*0*/ i1: kotlin.Int): kotlin.Int + public final operator fun get(/*0*/ i1: kotlin.Int, /*1*/ i2: kotlin.Int): kotlin.Int public final fun getCharArray(): kotlin.CharArray public final fun getIntArray(): kotlin.IntArray public final fun getLongArray(): kotlin.LongArray public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(): kotlin.Unit + public final operator fun invoke(/*0*/ x: [ERROR : Type annotation was missing for parameter x]): (kotlin.Any) -> kotlin.Any + public final operator fun invoke(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any): kotlin.Unit + public final operator fun set(/*0*/ i1: kotlin.Int, /*1*/ el: kotlin.Int): kotlin.Unit + public final operator fun set(/*0*/ i1: kotlin.Int, /*1*/ i2: kotlin.Int, /*2*/ el: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public final class _NestedClass { - public constructor _NestedClass() + public final class NestedClass { + public constructor NestedClass() public final val prop_4: kotlin.Int = 4 public final val prop_5: kotlin.Int = 5 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -85,6 +106,33 @@ public open class ClassLevel2 : ClassLevel1 { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +public open class ClassLevel21 : ClassLevel1 { + public constructor ClassLevel21() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test21(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassLevel22 : ClassLevel1 { + public constructor ClassLevel22() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test22(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassLevel23 : ClassLevel1 { + public constructor ClassLevel23() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test23(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + public open class ClassLevel3 : ClassLevel2 { public constructor ClassLevel3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -145,14 +193,43 @@ public final class ClassWithCompanionObject { } } -public final class ClassWithSixTypeParameters { - public constructor ClassWithSixTypeParameters() +public open class ClassWithCostructorParam { + public constructor ClassWithCostructorParam(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class ClassWithThreeTypeParameters { +public open class ClassWithCostructorTwoParams { + public constructor ClassWithCostructorTwoParams(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any) + public final val x: kotlin.Any + public final val y: kotlin.Any + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithCustomEquals { + public constructor ClassWithCustomEquals() + public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithSixTypeParameters { + public constructor ClassWithSixTypeParameters(/*0*/ u: R, /*1*/ x: K, /*2*/ y: M, /*3*/ z: O) + public final val u: R + public final val x: K + public final val y: M + public final val z: O + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithThreeTypeParameters { public constructor ClassWithThreeTypeParameters(/*0*/ x: K, /*1*/ y: L, /*2*/ z: M) public final val x: K public final val y: L @@ -189,6 +266,10 @@ public final class In { public final class Inv { public constructor Inv(/*0*/ x: T = ...) + public final val prop_1: Inv? = null + public final val prop_2: T? = null + public final val prop_3: T + public final val prop_4: kotlin.Int = 10 public final val x: T public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun get(): T @@ -201,6 +282,8 @@ public final class Inv { public final class Out { public constructor Out(/*0*/ x: T = ...) + public final val prop_1: Inv? = null + public final val prop_2: T? = null public final val x: T public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun get(): T diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt index aaab2714d35..250abd74670 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractBuilder/effects/returns/pos/2.txt @@ -12,15 +12,28 @@ public fun case_3(/*0*/ value_1: kotlin.Any?, /*1*/ value_2: kotlin.Any?, /*2*/ public fun T.case_4(): kotlin.Boolean Returns(FALSE) -> is Char || == null +public operator fun Class?.dec(): Class? +public operator fun Class?.inc(): Class? +public operator fun Class?.minus(/*0*/ x: Class?): Class? +public operator fun Class?.plus(/*0*/ x: Class?): Class? + public final class Class { public constructor Class() public final val prop_1: kotlin.Int = 1 + public final val prop_10: kotlin.Number? = 3.0.toFloat() + public final val prop_11: kotlin.Int = 10 + public final var prop_12: kotlin.String + public final val prop_13: kotlin.Any? = "" + public final val prop_14: kotlin.Comparable<*>? = "" + public final val prop_15: kotlin.collections.Iterable<*>? = "" public final val prop_2: kotlin.Int = 2 public final val prop_3: kotlin.Int = 3 public final val prop_4: kotlin.Float? = 3.0.toFloat() public final val prop_5: kotlin.Float = 3.0.toFloat() public final val prop_6: kotlin.String = "..." - public final val prop_7: kotlin.Nothing? = "..." + public final val prop_7: kotlin.Nothing? = null + public final val prop_8: Class? = null + public final var prop_9: kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Char): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Int): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Long): kotlin.Boolean @@ -28,14 +41,22 @@ public final class Class { public final fun fun_1(): (kotlin.Int) -> (kotlin.Int) -> kotlin.Int public final fun fun_2(/*0*/ value_1: kotlin.Int): kotlin.Int public final fun fun_3(/*0*/ value_1: kotlin.Int): (kotlin.Int) -> kotlin.Int + public final fun fun_4(): Class? + public final operator fun get(/*0*/ i1: kotlin.Int): kotlin.Int + public final operator fun get(/*0*/ i1: kotlin.Int, /*1*/ i2: kotlin.Int): kotlin.Int public final fun getCharArray(): kotlin.CharArray public final fun getIntArray(): kotlin.IntArray public final fun getLongArray(): kotlin.LongArray public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(): kotlin.Unit + public final operator fun invoke(/*0*/ x: [ERROR : Type annotation was missing for parameter x]): (kotlin.Any) -> kotlin.Any + public final operator fun invoke(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any): kotlin.Unit + public final operator fun set(/*0*/ i1: kotlin.Int, /*1*/ el: kotlin.Int): kotlin.Unit + public final operator fun set(/*0*/ i1: kotlin.Int, /*1*/ i2: kotlin.Int, /*2*/ el: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public final class _NestedClass { - public constructor _NestedClass() + public final class NestedClass { + public constructor NestedClass() public final val prop_4: kotlin.Int = 4 public final val prop_5: kotlin.Int = 5 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -61,6 +82,33 @@ public open class ClassLevel2 : ClassLevel1 { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +public open class ClassLevel21 : ClassLevel1 { + public constructor ClassLevel21() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test21(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassLevel22 : ClassLevel1 { + public constructor ClassLevel22() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test22(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassLevel23 : ClassLevel1 { + public constructor ClassLevel23() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test23(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + public open class ClassLevel3 : ClassLevel2 { public constructor ClassLevel3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -121,14 +169,43 @@ public final class ClassWithCompanionObject { } } -public final class ClassWithSixTypeParameters { - public constructor ClassWithSixTypeParameters() +public open class ClassWithCostructorParam { + public constructor ClassWithCostructorParam(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class ClassWithThreeTypeParameters { +public open class ClassWithCostructorTwoParams { + public constructor ClassWithCostructorTwoParams(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any) + public final val x: kotlin.Any + public final val y: kotlin.Any + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithCustomEquals { + public constructor ClassWithCustomEquals() + public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithSixTypeParameters { + public constructor ClassWithSixTypeParameters(/*0*/ u: R, /*1*/ x: K, /*2*/ y: M, /*3*/ z: O) + public final val u: R + public final val x: K + public final val y: M + public final val z: O + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithThreeTypeParameters { public constructor ClassWithThreeTypeParameters(/*0*/ x: K, /*1*/ y: L, /*2*/ z: M) public final val x: K public final val y: L @@ -165,6 +242,10 @@ public final class In { public final class Inv { public constructor Inv(/*0*/ x: T = ...) + public final val prop_1: Inv? = null + public final val prop_2: T? = null + public final val prop_3: T + public final val prop_4: kotlin.Int = 10 public final val x: T public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun get(): T @@ -177,6 +258,8 @@ public final class Inv { public final class Out { public constructor Out(/*0*/ x: T = ...) + public final val prop_1: Inv? = null + public final val prop_2: T? = null public final val x: T public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun get(): T diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt index 3774f6f0698..28efde1b5d2 100644 --- a/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/contracts/declarations/contractFunction/neg/2.txt @@ -2,16 +2,28 @@ package public fun case_1(): kotlin.Unit public fun case_2(): kotlin.Unit +public operator fun Class?.dec(): Class? +public operator fun Class?.inc(): Class? +public operator fun Class?.minus(/*0*/ x: Class?): Class? +public operator fun Class?.plus(/*0*/ x: Class?): Class? public final class Class { public constructor Class() public final val prop_1: kotlin.Int = 1 + public final val prop_10: kotlin.Number? = 3.0.toFloat() + public final val prop_11: kotlin.Int = 10 + public final var prop_12: kotlin.String + public final val prop_13: kotlin.Any? = "" + public final val prop_14: kotlin.Comparable<*>? = "" + public final val prop_15: kotlin.collections.Iterable<*>? = "" public final val prop_2: kotlin.Int = 2 public final val prop_3: kotlin.Int = 3 public final val prop_4: kotlin.Float? = 3.0.toFloat() public final val prop_5: kotlin.Float = 3.0.toFloat() public final val prop_6: kotlin.String = "..." - public final val prop_7: kotlin.Nothing? = "..." + public final val prop_7: kotlin.Nothing? = null + public final val prop_8: Class? = null + public final var prop_9: kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Char): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Int): kotlin.Boolean public final operator fun contains(/*0*/ a: kotlin.Long): kotlin.Boolean @@ -19,14 +31,22 @@ public final class Class { public final fun fun_1(): (kotlin.Int) -> (kotlin.Int) -> kotlin.Int public final fun fun_2(/*0*/ value_1: kotlin.Int): kotlin.Int public final fun fun_3(/*0*/ value_1: kotlin.Int): (kotlin.Int) -> kotlin.Int + public final fun fun_4(): Class? + public final operator fun get(/*0*/ i1: kotlin.Int): kotlin.Int + public final operator fun get(/*0*/ i1: kotlin.Int, /*1*/ i2: kotlin.Int): kotlin.Int public final fun getCharArray(): kotlin.CharArray public final fun getIntArray(): kotlin.IntArray public final fun getLongArray(): kotlin.LongArray public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final operator fun invoke(): kotlin.Unit + public final operator fun invoke(/*0*/ x: [ERROR : Type annotation was missing for parameter x]): (kotlin.Any) -> kotlin.Any + public final operator fun invoke(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any): kotlin.Unit + public final operator fun set(/*0*/ i1: kotlin.Int, /*1*/ el: kotlin.Int): kotlin.Unit + public final operator fun set(/*0*/ i1: kotlin.Int, /*1*/ i2: kotlin.Int, /*2*/ el: kotlin.Int): kotlin.Unit public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String - public final class _NestedClass { - public constructor _NestedClass() + public final class NestedClass { + public constructor NestedClass() public final val prop_4: kotlin.Int = 4 public final val prop_5: kotlin.Int = 5 public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -52,6 +72,33 @@ public open class ClassLevel2 : ClassLevel1 { public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } +public open class ClassLevel21 : ClassLevel1 { + public constructor ClassLevel21() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test21(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassLevel22 : ClassLevel1 { + public constructor ClassLevel22() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test22(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassLevel23 : ClassLevel1 { + public constructor ClassLevel23() + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final override /*1*/ /*fake_override*/ fun test1(): kotlin.Unit + public final fun test23(): kotlin.Unit + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + public open class ClassLevel3 : ClassLevel2 { public constructor ClassLevel3() public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean @@ -112,14 +159,43 @@ public final class ClassWithCompanionObject { } } -public final class ClassWithSixTypeParameters { - public constructor ClassWithSixTypeParameters() +public open class ClassWithCostructorParam { + public constructor ClassWithCostructorParam(/*0*/ x: kotlin.Any) + public final val x: kotlin.Any public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String } -public final class ClassWithThreeTypeParameters { +public open class ClassWithCostructorTwoParams { + public constructor ClassWithCostructorTwoParams(/*0*/ x: kotlin.Any, /*1*/ y: kotlin.Any) + public final val x: kotlin.Any + public final val y: kotlin.Any + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithCustomEquals { + public constructor ClassWithCustomEquals() + public open override /*1*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithSixTypeParameters { + public constructor ClassWithSixTypeParameters(/*0*/ u: R, /*1*/ x: K, /*2*/ y: M, /*3*/ z: O) + public final val u: R + public final val x: K + public final val y: M + public final val z: O + public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean + public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int + public final fun test(): kotlin.Int + public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String +} + +public open class ClassWithThreeTypeParameters { public constructor ClassWithThreeTypeParameters(/*0*/ x: K, /*1*/ y: L, /*2*/ z: M) public final val x: K public final val y: L @@ -156,6 +232,10 @@ public final class In { public final class Inv { public constructor Inv(/*0*/ x: T = ...) + public final val prop_1: Inv? = null + public final val prop_2: T? = null + public final val prop_3: T + public final val prop_4: kotlin.Int = 10 public final val x: T public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun get(): T @@ -168,6 +248,8 @@ public final class Inv { public final class Out { public constructor Out(/*0*/ x: T = ...) + public final val prop_1: Inv? = null + public final val prop_2: T? = null public final val x: T public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean public final fun get(): T diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt new file mode 100644 index 00000000000..fdbad6d3278 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt @@ -0,0 +1,483 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 1 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, functions, typealiases, properties, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x != null is Boolean) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + if (Object.prop_1 == null !== null) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Char?) { + if (x != null || false is Boolean) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Unit? = null + + if (x !== null is Boolean?) x + if (x !== null == null) x.equals(null) + if (x !== null == null) x.propT + if (x !== null == null) x.propAny + if (x !== null == null) x.propNullableT + if (x !== null == null) x.propNullableAny + if (x !== null == null) x.funT() + if (x !== null == null) x.funAny() + if (x !== null == null) x.funNullableT() + if (x !== null == null) x.funNullableAny() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: EmptyClass?) { + val y = true + + if ((x != null && !y) is Boolean) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + if (nullableNumberProperty != null || nullableNumberProperty != null is Boolean) { + nullableNumberProperty + nullableNumberProperty.equals(null) + nullableNumberProperty.propT + nullableNumberProperty.propAny + nullableNumberProperty.propNullableT + nullableNumberProperty.propNullableAny + nullableNumberProperty.funT() + nullableNumberProperty.funAny() + nullableNumberProperty.funNullableT() + nullableNumberProperty.funNullableAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: TypealiasNullableString) { + if (x !== null === null && x != null != null) x.get(0) + if (x !== null != null && x != null === null) x.get(0) +} + +// TESTCASE NUMBER: 9 +fun case_9(x: TypealiasNullableString?) { + if (x === null === null) { + + } else if (false is Boolean) { + x + x.get(0) + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + val a = Class() + + if (a.prop_4 === null || true is Boolean) { + if (a.prop_4 != null !== null) { + a.prop_4 + a.prop_4.equals(null) + a.prop_4.propT + a.prop_4.propAny + a.prop_4.propNullableT + a.prop_4.propNullableAny + a.prop_4.funT() + a.prop_4.funAny() + a.prop_4.funNullableT() + a.prop_4.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndirect) { + val t: TypealiasNullableStringIndirect = null + + if (x == null is Boolean) { + + } else { + if (y != null is Boolean == true) { + if ((nullableStringProperty == null) !is Boolean) { + if (t != null is Boolean) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndirect) = + if ((x == null) !is Boolean === false) "1" + else if ((y === null !== null) is Boolean) x + else if (y === null != null) x.equals(null) + else if (y === null != null) x.propT + else if (y === null != null) x.propAny + else if (y === null != null) x.propNullableT + else if (y === null != null) x.propNullableAny + else if (y === null != null) x.funT() + else if (y === null != null) x.funAny() + else if (y === null != null) x.funNullableT() + else if (y === null != null) x.funNullableAny() + else "-1" + +// TESTCASE NUMBER: 13 +fun case_13(x: otherpackage.Case13?) = + if ((x == null !is Boolean) !== true) { + throw Exception() + } else { + x + x.equals(x) + } + +// TESTCASE NUMBER: 14 +class Case14 { + val x: otherpackage.Case14? + init { + x = otherpackage.Case14() + } +} + +fun case_14() { + val a = Case14() + + if (a.x != null !is Boolean !is Boolean) { + if (a.x != null == true) { + if (a.x !== null == false) { + if (a.x != null == null) { + if (a.x != null !== null) { + if (a.x != null === true) { + if (a.x !== null === true !is Boolean == true) { + if (a.x != null !== false) { + if (a.x != null === false) { + if (a.x !== null === true) { + if ((a.x != null != true) !is Boolean) { + if (a.x != null is Boolean) { + if (a.x != null is Boolean is Boolean) { + if (a.x !== null is Boolean) { + if (a.x != null is Boolean) { + if ((a.x !== null !is Boolean) == false) { + a.x + a.x.equals(a.x) + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: EmptyObject) { + val t = if (x === null is Boolean is Boolean is Boolean) "" else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 16 +fun case_16() { + val x: TypealiasNullableNothing = null + + if (x != null !is Boolean !is Boolean !is Boolean !is Boolean !is Boolean) { + x + x.java + } +} + +// TESTCASE NUMBER: 17 +val case_17 = if (nullableIntProperty == null == true == false) 0 else { + nullableIntProperty + nullableIntProperty.java +} + +//TESTCASE NUMBER: 18 +fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?) { + if (a != null !== null) { + a + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } +} + +// TESTCASE NUMBER: 19 +fun case_19(b: Boolean) { + val a = if (b) { + object { + val B19 = if (b) { + object { + val C19 = if (b) { + object { + val D19 = if (b) { + object { + val x: Number? = 10 + } + } else null + } + } else null + } + } else null + } + } else null + + if (a != null !is Boolean && a.B19 != null is Boolean && a.B19.C19 != null is Boolean && a.B19.C19.D19 != null == null && a.B19.C19.D19.x != null !== null) { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 20 +fun case_20(b: Boolean) { + val a = object { + val B19 = object { + val C19 = object { + val D19 = if (b) { + object {} + } else null + } + } + } + + if (a.B19.C19.D19 !== null !is Boolean) { + .B19..C19..D19.?")!>a.B19.C19.D19 + .B19..C19..D19.?")!>a.B19.C19.D19.equals(null) + .B19..C19..D19.?")!>a.B19.C19.D19.propT + .B19..C19..D19.?")!>a.B19.C19.D19.propAny + .B19..C19..D19.?")!>a.B19.C19.D19.propNullableT + .B19..C19..D19.?")!>a.B19.C19.D19.propNullableAny + .B19..C19..D19.?")!>a.B19.C19.D19.funT() + .B19..C19..D19.?")!>a.B19.C19.D19.funAny() + .B19..C19..D19.?")!>a.B19.C19.D19.funNullableT() + .B19..C19..D19.?")!>a.B19.C19.D19.funNullableAny() + } +} + +// TESTCASE NUMBER: 21 +fun case_21() { + if (EnumClassWithNullableProperty.B.prop_1 !== null is Boolean == true !is Boolean != true) { + EnumClassWithNullableProperty.B.prop_1 + EnumClassWithNullableProperty.B.prop_1.equals(null) + EnumClassWithNullableProperty.B.prop_1.propT + EnumClassWithNullableProperty.B.prop_1.propAny + EnumClassWithNullableProperty.B.prop_1.propNullableT + EnumClassWithNullableProperty.B.prop_1.propNullableAny + EnumClassWithNullableProperty.B.prop_1.funT() + EnumClassWithNullableProperty.B.prop_1.funAny() + EnumClassWithNullableProperty.B.prop_1.funNullableT() + EnumClassWithNullableProperty.B.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 22 +fun case_22(a: (() -> Unit)?) { + if (a != null !is Boolean) { + a() + a().equals(null) + a().propT + a().propAny + a().propNullableT + a().propNullableAny + a().funT() + a().funAny() + a().funNullableT() + a().funNullableAny() + } +} + +// TESTCASE NUMBER: 23 +fun case_23(a: ((Float) -> Int?)?, b: Float?) { + if (a != null !is Boolean && b !== null is Boolean) { + val x = a(b) + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 24 +fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = + if (a !== null is Boolean && b !== null !is Boolean) { + a( kotlin.Unit)?"), TYPE_MISMATCH!>b) + a(b) + kotlin.Unit)?")!>b.equals(null) + kotlin.Unit)?")!>b.propT + kotlin.Unit)?")!>b.propAny + kotlin.Unit)?")!>b.propNullableT + kotlin.Unit)?")!>b.propNullableAny + kotlin.Unit)?")!>b.funT() + kotlin.Unit)?")!>b.funAny() + kotlin.Unit)?")!>b.funNullableT() + kotlin.Unit)?")!>b.funNullableAny() + } else null + +// TESTCASE NUMBER: 25 +fun case_25(b: Boolean) { + val x = { + if (b) object { + val a = 10 + } else null + } + + val y = if (b) x else null + + if (y !== null === true) { + val z = .?")!>y() + + if (z != null !== false) { + .?")!>z.a + .?")!>z.a.equals(null) + .?")!>z.a.propT + .?")!>z.a.propAny + .?")!>z.a.propNullableT + .?")!>z.a.propNullableAny + .?")!>z.a.funT() + .?")!>z.a.funAny() + .?")!>z.a.funNullableT() + .?")!>z.a.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 26 +fun case_26(a: ((Float) -> Int?)?, b: Float?) { + if (a != null == true == false && b != null == true == false) { + val x = a(b) + if (x != null == true === false) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 27 +fun case_27() { + if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true is Boolean) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt new file mode 100644 index 00000000000..92c73c4178f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt @@ -0,0 +1,26 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 10 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + var x: Any? = null + + if (true) { + x = ClassLevel2() + } else { + x = ClassLevel3() + } + + x + x.inv() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.kt new file mode 100644 index 00000000000..2469667a939 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.kt @@ -0,0 +1,81 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 11 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + var x: Boolean? = true + if (x is Boolean && if (true) { x = null; true } else { false }) { + x + x.not() + } +} + +// TESTCASE NUMBER: 2 +fun case_2() { + var x: Boolean? = true + if (x != null && try { x = null; true } catch (e: Exception) { false }) { + x + x.not() + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: Boolean? = true + if (x is Boolean) { + funWithAnyArg(try { x = null; true } catch (e: Exception) { false }) + x + x.not() + } +} + +// TESTCASE NUMBER: 4 +fun case_4() { + var x: Boolean? = true + if (x != null) { + false || when { else -> {x = null; true} } + x + x.not() + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + var x: Int? = null + if (x == try { x = 10; null } finally {} && x != null) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 6 +fun case_6() { + var x: Boolean? = true + x as Boolean + if (if (true) { x = null; true } else { false }) { + x + x.not() + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + var x: Boolean? = true + x!! + if (if (true) { x = null; true } else { false }) {} + + x + x.not() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt new file mode 100644 index 00000000000..068f21b3017 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt @@ -0,0 +1,58 @@ + +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 12 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28370 + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + var x: Int? = 11 + x!! + try {x = null;} finally { x += 10; } +} + +// TESTCASE NUMBER: 2 +fun case_2() { + var x: Boolean? = true + if (x != null) { + try { + throw Exception() + } catch (e: Exception) { + x = null + } + x.not() + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: Boolean? = true + if (x is Boolean) { + try { + throw Exception() + } catch (e: Exception) { + x = null + } + x.not() + } +} + +// TESTCASE NUMBER: 4 +fun case_4() { + var x: Boolean? = true + x as Boolean + try { + x = null + } finally { } + x.not() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.kt new file mode 100644 index 00000000000..abbe8525f3f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.kt @@ -0,0 +1,40 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 13 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Class?) { + x!! + x[if (true) {x=null;0} else 0] += x[0] + x + x[0].inv() +} + +// TESTCASE NUMBER: 2 +fun case_2() { + var x: Class? = 10 + x!! + x(if (true) {x=null;0} else 0, x) + x + x.fun_1() +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: Class? = Class() + x!! + val y = x[if (true) {x=null;0} else 0, x[0]] + x + x.fun_1() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.kt new file mode 100644 index 00000000000..b7c1050f3f5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.kt @@ -0,0 +1,60 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 14 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Int?) { + if ((x is Int) ?: (x is Int)) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Int?) { + if (x?.equals(1) ?: x is Int) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Boolean?) { + if (x ?: (x != null)) { + x + x.not() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Boolean?) { + if (if (x != null) x else x != null) { + x + x.not() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (if (x is String) true else false) { + x + x.length + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if ((if (x != null) true else null) != null) { + x + x.length + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.kt new file mode 100644 index 00000000000..868b872011f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.kt @@ -0,0 +1,144 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 15 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_1() { + var x: Boolean? = true + if (x is Boolean && if (true) { x = null; true } else { false }) { + x + x.not() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_2() { + var x: Boolean? = true + if (x !== null && try { x = null; true } catch (e: Exception) { false }) { + x + x.not() + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_3() { + var x: Boolean? = true + if (x != null) { + false || when { else -> { x = null; true} } + x + x.not() + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_4() { + var x: Int? = null + if (x == try { x = 10; null } finally {} && x != null) { + x + x.inv() + println(1) + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_5() { + var x: Boolean? = true + if (x != null) { + when { else -> { x = null; false} } || x.not() + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_6() { + var x: Boolean? = true + if (x != null) { + if (true) {x = null; true} else true && x.not() + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_7() { + var x: Boolean? = true + if (x != null) { + (if (true) {x = null; null} else true) ?: x.not() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(y: MutableList) { + var x: Boolean? = true + if (x != null) { + y[if (true) {x = null;0} else 0] = x + } +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_9() { + var x: Boolean? = true + if (x is Boolean) { + funWithAnyArg(try { x = null; true } catch (e: Exception) { false }) + x + x.not() + } +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28369 + */ +fun case_10() { + var x: Boolean? = true + if (x is Boolean) { + select(if (true) {x = null;Class()} else Class()).prop_9 = x.not() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(y: MutableList>) { + var x: Int? = 10 + if (x != null) { + y[if (true) {x = null;0} else 0][x] = 10 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.kt new file mode 100644 index 00000000000..fe62b05113a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.kt @@ -0,0 +1,115 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 16 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_1(x: ClassWithCustomEquals) { + val y = null + if (x == y) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: ClassWithCustomEquals) { + if (x == null) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28243 + */ +fun case_3(x: ClassWithCustomEquals, y: Nothing?) { + if (x == y) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_4(x: ClassWithCustomEquals) { + val y = null + if (y == x) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28243 + */ +fun case_5(x: ClassWithCustomEquals, y: Nothing?) { + if (y == x) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_6(x: ClassWithCustomEquals) { + val y = null + if (x == y == true) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: ClassWithCustomEquals) { + if ((x != null) == false) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28243 + */ +fun case_8(x: ClassWithCustomEquals, y: Nothing?) { + if (!(y == x) == false) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28243 + */ +fun case_9(x: ClassWithCustomEquals?, y: Interface1) { + if (x == y) { + x + x.itest1() + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.kt new file mode 100644 index 00000000000..62cf484da3b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.kt @@ -0,0 +1,38 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 17 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-28362 + */ +fun case_1(x: Any) { + if (x is Interface1) { + if (x is Interface2) { + x + x.itest00() + } + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-28362 + */ +fun case_2(x: Any) { + if (x is Interface2) { + if (x is Interface1) { + x + x.itest00000() + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/18.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/18.kt new file mode 100644 index 00000000000..38ca8a49fc7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/18.kt @@ -0,0 +1,78 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 18 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-30826 + */ +fun case_1(x: Interface1?) { + var y = x + y as Interface2 + val foo = { + y.itest2() + } + y = null + foo() +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-30826 + */ +fun case_2(x: Interface1?) { + var y = x + y as Interface2 + val foo = fun () { + y.itest2() + } + y = null + foo() +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-30826 + */ +fun case_3(x: Interface1?) { + var y = x + y as Interface2 + fun foo() { + y.itest2() + } + y = null + foo() +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Interface1?) { + var y = x + y as Interface2 + y = null + fun foo() { + y.itest2() + } + y = x + foo() +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Interface1?) { + var y = x + y as Interface2 + y = null + fun foo() { + y.itest2() + } + y = x + foo() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.kt new file mode 100644 index 00000000000..7a38e862a3a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.kt @@ -0,0 +1,386 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 19 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_1(x: Boolean?) { + l1@ while (true) { + l2@ while (true || x!!) { + break@l1 + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_2(x: Boolean?) { + l1@ while (true) { + l2@ do { + break@l1 + } while (true || x!!) + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_3(x: Boolean?) { + l1@ do { + l2@ do { + break@l1 + } while (true || x!!) + } while (true) + + x + x.not() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_4(x: Boolean?) { + l1@ do { + l2@ do { + break@l1 + } while (x!!) + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Boolean?) { + l1@ do { + l2@ do { + break@l2 + } while (x!!) + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Boolean?) { + l1@ do { + l2@ do { + break@l1 + } while (true) + } while (x!!) + + x + x.not() +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Boolean?) { + l1@ while (true) { + l2@ while (true || x!!) { + break@l2 + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_8(x: Boolean?) { + l1@ while (true || x!!) { + l2@ while (true) { + break@l2 + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Boolean?) { + l1@ while (true) { + break@l1 + l2@ while (x!!) { + + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_10(x: Boolean?) { + l1@ while (true) { + l2@ while (break@l1 || x!!) { + + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Boolean?) { + l1@ while (true) { + l2@ while (break@l1 && x!!) { + + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Boolean?) { + while (true) { + break || x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 13 +fun case_13(x: Boolean?) { + while (true) { + break && x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 14 +fun case_14(x: Boolean?) { + do { + break || x!! + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 15 +fun case_15(x: Boolean?) { + do { + break && x!! + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 16 +fun case_16(x: Boolean?) { + do { + break + } while (x!!) + + x + x.not() +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_17(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l2 || x!!) { + + } + } + break + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 18 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_18(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l1 || x!!) { + + } + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 19 +fun case_19(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l1 && x!!) { + + } + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 20 +fun case_20(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l2 && x!!) { + + } + } + break + } + + x + x.not() +} + +// TESTCASE NUMBER: 21 +fun case_21(x: Boolean?) { + for (i in listOf(1, 2, 3)) { + break || x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 22 +fun case_22(x: Boolean?) { + for (i in listOf(1, 2, 3)) { + break && x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 23 +fun case_23(x: Boolean?) { + l1@ for (i in listOf(1, 2, 3)) { + l2@ for (j in listOf(1, 2, 3)) { + break@l1 || x!! + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 24 +fun case_24(x: Boolean?) { + l1@ for (i in listOf(1, 2, 3)) { + l2@ for (j in listOf(1, 2, 3)) { + true || x!! + break@l1 + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 25 +fun case_25(x: Boolean?) { + l1@ for (i in listOf(1, 2, 3)) { + l2@ for (j in listOf(true || x!!, break@l1 || x!!, x!!)) { + break@l1 + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 26 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30867 + */ +fun case_26(x: Boolean?) { + while (true) { + for (i in listOf(break, x!!, x!!)) { + + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 27 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30868 + */ +fun case_27(x: Int?, y: Class) { + while (true) { + y[break, x!!] + } + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 28 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30868 + */ +fun case_28(x: Int?, y: List>) { + while (true) { + y[break][x!!] + } + + x + x.inv() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.kt new file mode 100644 index 00000000000..bada49abf4c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.kt @@ -0,0 +1,99 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 2 + * DESCRIPTION: Raw data flow analysis test + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Nothing) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any) { + if (x is Nothing) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x !is Nothing) else { + x + x.inv() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any) { + if (x !is Nothing) else { + x + x.inv() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (!(x !is Nothing?)) { + x + x?.inv() + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (!(x !is Nothing)) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any) { + if (!(x is Nothing)) else { + x + x.inv() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (!(x is Nothing?)) else { + x + x?.inv() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (!!(x !is Nothing?)) else { + x + x?.inv() + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + if (!!(x !is Nothing)) else { + x + x.inv() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + if (x is Nothing?) { + x + x?.inv() + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.kt new file mode 100644 index 00000000000..6650efd957f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.kt @@ -0,0 +1,401 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 20 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_1(x: Boolean?) { + l1@ while (true) { + l2@ while (true || x as Boolean) { + break@l1 + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_2(x: Boolean?) { + l1@ while (true) { + l2@ do { + break@l1 + } while (true || x as Boolean) + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_3(x: Boolean?) { + l1@ do { + l2@ do { + break@l1 + } while (true || x as Boolean) + } while (true) + + x + x.not() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_4(x: Boolean?) { + l1@ do { + l2@ do { + break@l1 + } while (x as Boolean) + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Boolean?) { + l1@ do { + l2@ do { + break@l2 + } while (x as Boolean) + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Boolean?) { + l1@ do { + l2@ do { + break@l1 + } while (true) + } while (x as Boolean) + + x + x.not() +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Boolean?) { + l1@ while (true) { + l2@ while (true || x as Boolean) { + break@l2 + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_8(x: Boolean?) { + l1@ while (true || x as Boolean) { + l2@ while (true) { + break@l2 + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Boolean?) { + l1@ while (true) { + break@l1 + l2@ while (x as Boolean) { + + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_10(x: Boolean?) { + l1@ while (true) { + l2@ while (break@l1 || x as Boolean) { + + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Boolean?) { + l1@ while (true) { + l2@ while (break@l1 && x as Boolean) { + + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Boolean?) { + while (true) { + break || x as Boolean + } + + x + x.not() +} + +// TESTCASE NUMBER: 13 +fun case_13(x: Boolean?) { + while (true) { + break && x as Boolean + } + + x + x.not() +} + +// TESTCASE NUMBER: 14 +fun case_14(x: Boolean?) { + do { + break || x as Boolean + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 15 +fun case_15(x: Boolean?) { + do { + break && x as Boolean + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 16 +fun case_16(x: Boolean?) { + do { + break + } while (x as Boolean) + + x + x.not() +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_17(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l2 || x as Boolean) { + + } + } + break + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 18 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28489 + */ +fun case_18(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l1 || x as Boolean) { + + } + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 19 +fun case_19(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l1 && x as Boolean) { + + } + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 20 +fun case_20(x: Boolean?) { + l1@ while (true) { + l2@ while (true) { + l3@ while (break@l2 && x as Boolean) { + + } + } + break + } + + x + x.not() +} + +// TESTCASE NUMBER: 21 +fun case_21(x: Boolean?) { + for (i in listOf(1, 2, 3)) { + break || x as Boolean + } + + x + x.not() +} + +// TESTCASE NUMBER: 22 +fun case_22(x: Boolean?) { + for (i in listOf(1, 2, 3)) { + break && x as Boolean + } + + x + x.not() +} + +// TESTCASE NUMBER: 23 +fun case_23(x: Boolean?) { + l1@ for (i in listOf(1, 2, 3)) { + l2@ for (j in listOf(1, 2, 3)) { + break@l1 || x as Boolean + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 24 +fun case_24(x: Boolean?) { + l1@ for (i in listOf(1, 2, 3)) { + l2@ for (j in listOf(1, 2, 3)) { + true || x as Boolean + break@l1 + } + } + + x + x.not() +} + +// TESTCASE NUMBER: 25 +fun case_25(x: Boolean?) { + l1@ for (i in listOf(1, 2, 3)) { + l2@ for (j in listOf(true || x as Boolean, break@l1 || x as Boolean, x as Boolean)) { + break@l1 + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 26 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30867 + */ +fun case_26(x: Boolean?) { + while (true) { + for (i in listOf(break, x as Boolean, x!!)) { + + } + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 27 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30868 + */ +fun case_27(x: Int?, y: Class) { + while (true) { + y[break, x as Int] + } + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 28 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30868 + */ +fun case_28(x: Int?, y: List>) { + while (true) { + y[break][x as Int] + } + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 29 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30868 + */ +fun case_29(x: Boolean?, y: MutableList) { + while (true) { + y[break] = 10 + x!! + } + + x + x.not() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.kt new file mode 100644 index 00000000000..fc78c28c868 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.kt @@ -0,0 +1,55 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 21 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28508 + */ +class Case1 { + val x: Int? + init { + val y = this + if (y.x != null) { + x = null + x + this.x + y.x + y.x.inv() + } else { + x = 10 + } + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28508 + */ +class Case2 { + val x: Int + init { + val y = this + if (y.x == null) { + x = 11 + x + this.x + y.x + y.x.inv() + println(1) + } else { + x = 11 + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt new file mode 100644 index 00000000000..9380c05fd39 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt @@ -0,0 +1,233 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 22 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_1(x: Boolean?, y: Boolean?) { + while (true) { + y != null || break + x!! + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_2(x: Boolean?, y: Boolean?) { + do { + y != null || break + x!! + } while (true) + + x + x.not() +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_3(x: Boolean?, y: Boolean?) { + while (true) { + y != null && break + x!! + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_4(x: Boolean?, y: Boolean?) { + do { + y != null && break + x!! + } while (true) + + x + x.not() +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Boolean?, y: Boolean?) { + while (true) { + y.to(break) + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Boolean?, y: ((x: Nothing) -> Unit)?) { + while (true) { + y!!(break) + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Boolean?, y: Boolean?) { + while (true) { + y ?: break + x!! + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_8(x: Boolean?, y: Boolean?) { + while (true) { + y ?: (y!! || break) + x!! + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_9(x: Int?) { + val y: Int + while (true) { + y = break as Int + x!! + } + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_10(x: Int?) { + val y: Int + do { + break as Int + x as Int + } while (true) + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_11(x: Int?) { + operator fun Nothing.invoke(x: Any) = x + + val y: Int + while (true) { + break(x!!) + } + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 12 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_12(x: Int?) { + operator fun Nothing.get(x: Int, y: Int) = x + y + + val y: Int + while (true) { + break[x!!] + } + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_13(x: Int?) { + operator fun Nothing.set(x: Int, y: Int) {} + + val y: Int + while (true) { + break[x!!] = 10 + } + + x + x.inv() +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_14(x: Int?) { + operator fun Nothing.set(x: Int, y: Int) {} + + val y: Int + while (true) { + break[10] = x!! + } + + x + x.inv() +} + +// TESTCASE NUMBER: 15 +fun case_15(x: Int?) { + operator fun Nothing.invoke(x: () -> Unit) = x() + + val y: Int + while (true) { + break { + x!! + } + } + + x + x.not() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.kt new file mode 100644 index 00000000000..cf28fb04692 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.kt @@ -0,0 +1,77 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 23 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-28965 + */ +inline fun case_1(x: T) { + if (x is K) { + x + x.equals(x) + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-28965 + */ +inline fun case_2(x: T) { + x as K + x + x.equals(x) +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-28965 + */ +inline fun case_3() { + var x: T? = 10 as T + x = null + if (x is K) { + x.equals(10) + x + println(1) + } +} + +// TESTCASE NUMBER: 4 +inline fun case_4(x: T?) { + if (x is K) { + x + x.equals(x) + } +} + +// TESTCASE NUMBER: 5 +inline fun case_5(x: T) { + if (x is K?) { + x + x.equals(x) + } +} + +/* + * TESTCASE NUMBER: 6 + * ISSUES: KT-28965 + */ +inline fun case_6() { + var x: T? = 10 as T + if (x is K) { + x = null + x.equals(10) + x + println(1) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.kt new file mode 100644 index 00000000000..e636529ffd2 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.kt @@ -0,0 +1,118 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 24 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28370 + */ +fun case_1() { + var x: Boolean? = true + if (x != null) { + try { + throw Exception() + } catch (e: Exception) { + x = null + } + x + x.not() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28370 + */ +fun case_2() { + var x: Boolean? = true + if (x != null) { + try { + x = null + } finally { } + x + x.not() + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29482 + */ +fun case_3(x: String?) { + while (true) { + try { + if (x == null) { + throw Exception() + } + } catch (e: Exception) { + break + } + } + x + x.length +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29482 + */ +fun case_4(x: String?) { + while (true) { + try { + x!! + } catch (e: Exception) { + break + } + } + x + x.length +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29482 + */ +fun case_5(x: String?) { + do { + try { + x!! + } catch (e: Exception) { + break + } + } while (true) + x + x.length +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29482 + */ +fun case_6(x: String?) { + do { + try { + if (x == null) { + throw Exception() + } + } catch (e: Exception) { + break + } + } while (true) + x + x.length +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.kt new file mode 100644 index 00000000000..a791edfa358 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.kt @@ -0,0 +1,62 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 25 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1, 2 +class ClassWithEqualsOverride { + override fun equals(other: Any?) = true + fun fun_1() = true +} + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28239 + */ +fun case_1() { + val x: ClassWithEqualsOverride? = null + val y = ClassWithEqualsOverride() + if (y == x) { + x + x.fun_1() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28239 + */ +fun case_2() { + val x: ClassWithEqualsOverride? = null + val y: ClassWithEqualsOverride? = ClassWithEqualsOverride() + if (y != null) { + if (y == x) { + x + x.fun_1() + } + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28239 + */ +fun case_3() { + val x: ClassWithEqualsOverride? = null + val y: ClassWithEqualsOverride? = ClassWithEqualsOverride() + if (y!! == x) { + x + x.fun_1() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.kt new file mode 100644 index 00000000000..1e58ac70b24 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.kt @@ -0,0 +1,125 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 26 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_1() { + var x: MutableList? = mutableListOf(1) + x!! + & kotlin.collections.MutableList?"), DEBUG_INFO_SMARTCAST!>x[if (true) {x=null;0} else 0] += & kotlin.collections.MutableList?"), DEBUG_INFO_SMARTCAST!>x[0] + & kotlin.collections.MutableList?")!>x + & kotlin.collections.MutableList?"), DEBUG_INFO_SMARTCAST!>x[0].inv() +} + +// TESTCASE NUMBER: 2 +fun case_2() { + var x: MutableList? = mutableListOf(1) + x!! + & kotlin.collections.MutableList?"), DEBUG_INFO_SMARTCAST!>x[if (true) {x=null;0} else 0] = ?")!>x[0] + ?")!>x + ?")!>x[0].inv() +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: MutableList? = mutableListOf(1) + x!! + & kotlin.collections.MutableList?"), DEBUG_INFO_SMARTCAST!>x[0] = if (true) {x=null;0} else 0 + ?")!>x + ?")!>x[0].inv() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_4() { + var x: Class? = Class() + x!! + val y = x[if (true) {x=null;0} else 0, x[0]] + x + x[0].inv() +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_5() { + var x: Class? = Class() + x!! + x(if (true) {x=null;0} else 0, x) + x.fun_1() +} + +// TESTCASE NUMBER: 6 +fun case_6() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?"), DEBUG_INFO_SMARTCAST!>x[if (true) {x=null;0} else 0][>?")!>x[0][0]] += 10 + > & kotlin.collections.MutableList>?")!>x + > & kotlin.collections.MutableList>?"), DEBUG_INFO_SMARTCAST!>x[0][0].inv() +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_7() { + var x: Class? = Class() + x!! + x(if (true) {x=null;0} else 0)(x) + x.fun_1() +} + +// TESTCASE NUMBER: 8 +fun case_8() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?"), DEBUG_INFO_SMARTCAST!>x[if (true) {x=null;0} else 0].addAll(1, >?")!>x[0]) +} + +// TESTCASE NUMBER: 9 +fun case_9() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?"), DEBUG_INFO_SMARTCAST!>x[if (true) {x=null;0} else 0].subList(0, 2)[>?")!>x[0][0]] +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_10() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?"), DEBUG_INFO_SMARTCAST!>x.subList(if (true) {x=null;0} else 0, 2)[> & kotlin.collections.MutableList>?"), DEBUG_INFO_SMARTCAST!>x[0][0]] +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_11() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?"), DEBUG_INFO_SMARTCAST!>x[if (true) {x=null;0} else 0].subList(>?")!>x[0][0], 2) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.kt new file mode 100644 index 00000000000..a6a29305acc --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.kt @@ -0,0 +1,121 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 27 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_1(x: Boolean?, y: Boolean?) { + while (true) { + y != null || break + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Boolean?, y: Int?) { + while (true) { + break || y == null + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Boolean?, y: Boolean?) { + while (true) { + if (y == null) { + break + } + x!! + } + + x + x.not() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28333 + */ +fun case_4(x: Boolean?, y: Boolean?) { + while (true) { + y == null && break + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Boolean?, y: Boolean?) { + while (true) { + y ?: break + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Boolean?, y: Boolean?) { + loop@ while (true) { + when (y) { + true -> break@loop + false -> break@loop + null -> if (true) break@loop else 1 + } + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Boolean?, y: Boolean?) { + loop@ while (true) { + when (y) { + true -> break@loop + false -> break@loop + null -> break@loop + } + x!! + } + + x + x.not() +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Boolean?, y: Boolean?) { + loop@ while (true) { + when (y) { + true -> x!! + false -> x!! + null -> if (true) x!! else break@loop + } + } + + x + x.not() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.kt new file mode 100644 index 00000000000..10a6b4aa8ca --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.kt @@ -0,0 +1,20 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 28 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun > Inv.case_1() { + if (this is MutableList<*>) { + & kotlin.collections.MutableList<*>"), DEBUG_INFO_EXPRESSION_TYPE("Inv")!>this + & kotlin.collections.MutableList<*>"), DEBUG_INFO_EXPRESSION_TYPE("Inv")!>this[0] = & kotlin.collections.MutableList<*>"), DEBUG_INFO_EXPRESSION_TYPE("Inv")!>this[1] + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.kt new file mode 100644 index 00000000000..ec9bed03f30 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.kt @@ -0,0 +1,125 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 29 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(a: Any?) { + while (true) { + if (a == null) break + if (true) continue + } + + a + a.equals(10) +} + +// TESTCASE NUMBER: 2 +fun case_2(a: Any?) { + (l@ { + while (true) { + if (a == null) return@l + if (true) break + } + })() + + a + a.equals(10) +} + +// TESTCASE NUMBER: 3 +fun case_3(a: Any?) { + loop1@ while (true) { + loop2@ while (true) { + if (true) break + if (a == null) return continue@loop1 + } + } + + a + a.equals(10) +} + +// TESTCASE NUMBER: 4 +fun case_4(a: Any?) { + loop1@ while (true) { + loop2@ while (true) { + break@loop1 + if (a == null) return + } + } + + a + a.equals(10) +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + */ +fun case_5(a: Any?) { + loop1@ while (true) { + loop2@ while (true) { + return break@loop1 + if (a == null) return + } + } + + a + a.equals(10) +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + */ +fun case_6(a: Any?) { + loop1@ while (true) { + loop2@ while (true) { + throw break@loop1 + if (a == null) return + } + } + + a + a.equals(10) +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + */ +fun case_7(a: Any?) { + loop1@ while (true) { + loop2@ while (true) { + throw continue@loop1 + if (a == null) return + } + } + + a + a.equals(10) +} + +// TESTCASE NUMBER: 8 +fun case_8(a: Any?) { + var b: Any? = 10 + loop1@ while (b != null) { + loop2@ while (true) { + b = null + return continue@loop1 + if (a == null) return + } + } + + a + a.equals(10) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt new file mode 100644 index 00000000000..0555d75c14e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt @@ -0,0 +1,102 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 3 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Nothing?) { + if (x is Int) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Nothing) { + if (x is Unit) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Nothing?) { + if (x !is Class) else { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Nothing) { + if (x !is EnumClass) else { + x + x.fun_1() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Nothing?) { + if (!(x !is Class.NestedClass?)) { + x + x?.prop_4 + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Nothing?) { + if (!(x !is Object)) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Nothing) { + if (!(x is DeepObject.A.B.C.D.E.F.G.J)) else { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Nothing?) { + if (!(x is Int?)) else { + x + x?.inv() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Nothing?) { + if (!!(x !is TypealiasNullableStringIndirect?)) else { + x + x?.length + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Nothing?) { + if (!!(x !is Interface3)) else { + x + x.itest() + x.itest3() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Nothing?) { + if (x is SealedMixedChildObject1?) { + x + x?.prop_1 + x?.prop_2 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.kt new file mode 100644 index 00000000000..e6af9badd71 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.kt @@ -0,0 +1,47 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 30 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * ISSUES: KT-30907 + */ + +// TESTCASE NUMBER: 1 +class Case1(val x: Any?) { + val y = x!! + val z: Any = x +} + +// TESTCASE NUMBER: 2 +class Case2(val y: Any?): ClassWithCostructorParam(y!!) { + val z: Any = y +} + +// TESTCASE NUMBER: 3 +class Case3(val y: Any?): ClassWithCostructorParam(y as Class) { + val z: Class = y +} + +// TESTCASE NUMBER: 4 +class Case4(val y: Any?): ClassWithCostructorParam(y!!) { + init { + val z: Any = y + } +} + +// TESTCASE NUMBER: 5 +class Case5(val y: Any?): ClassWithCostructorParam(y as Interface1), Interface1 by y {} + +// TESTCASE NUMBER: 6 +fun case_6(a: Int?) = object : ClassWithCostructorParam(a!!) { + fun run() = a.toShort() + init { + println(a.toShort()) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.kt new file mode 100644 index 00000000000..355b3d1d126 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.kt @@ -0,0 +1,21 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 31 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Interface1) = x +fun case_1(x: Interface2) = x +fun case_1() { + val x: Interface1 = null as Interface1 + x as Interface2 + case_1(x) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.kt new file mode 100644 index 00000000000..0acc3cf23e4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.kt @@ -0,0 +1,79 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 32 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1, 2, 3, 4, 5 +fun stringArg(number: String) {} + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-27464 + */ +fun case_1(x: Int?) { + if (x == null) { + stringArg(x!!) + x + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-27464 + */ +fun case_2(x: Int?, y: Nothing?) { + if (x == y) { + stringArg(x!!) + x + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-27464 + */ +fun case_3(x: Int?) { + if (x == null) { + x as Int + stringArg(x) + x + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-27464 + */ +fun case_4(x: Int?) { + if (x == null) { + x!! + stringArg(x) + x + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-27464 + */ +fun case_5(x: Int?) { + if (x == null) { + var y = x + y!! + stringArg(y) + y + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.kt new file mode 100644 index 00000000000..07a3c12c1c8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.kt @@ -0,0 +1,71 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 33 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1, 2, 3, 4, 5 +fun nullableStringArg(number: String?) {} + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25453 + */ +fun case_1(x: Int?) { + if (x == null) { + nullableStringArg(x) + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25453 + */ +fun case_2(x: Int?, y: Nothing?) { + if (x == y) { + nullableStringArg(x) + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25453 + */ +fun case_3(x: Int?) { + if (x == null) { + nullableStringArg(x) + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25453 + */ +fun case_4(x: Int?) { + if (x == null) { + nullableStringArg(x) + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25453 + */ +fun case_5(x: Int?) { + if (x == null) { + var y = x + nullableStringArg(y) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.kt new file mode 100644 index 00000000000..b9b63dc3007 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.kt @@ -0,0 +1,222 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 34 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22379 + */ +fun case_1() { + var x: String? = "..." + while (x!!.length > 1) { + x = null + break + } + x + x.length +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22379 + */ +fun case_3() { + var x: String? = "..." + while ((x as String).length > 1) { + x = null + break + } + x + x.length +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22379 + */ +fun case_4() { + var x: Boolean? = true + while (x!!) { + x = null + break + } + x + x.not() +} + +// TESTCASE NUMBER: 5 +fun case_5() { + var x: Boolean? = true + while (true && x!!) { + x + x.not() + x = null + break + } + x + x.not() +} + +// TESTCASE NUMBER: 6 +fun case_6() { + var x: Boolean? = true + while (false && x!!) { + x + x.not() + x = null + break + } + x + x.not() +} + +// TESTCASE NUMBER: 7 +fun case_7() { + var x: Boolean? = true + while (true || x!!) { + x + x.not() + x = null + break + } + x + x.not() +} + +// TESTCASE NUMBER: 8 +fun case_8() { + var x: Boolean? = true + while (!(false && x!!)) { + x + x.not() + x = null + break + } + x + x.not() +} + +// TESTCASE NUMBER: 9 +fun case_9() { + var x: String? = "..." + do { + x = null + break + } while (x!!.length > 1) + x + x.length +} + +// TESTCASE NUMBER: 10 +fun case_10() { + var x: String? = "..." + do { + x = null + break + } while ((x as String).length > 1) + x + x.length +} + +// TESTCASE NUMBER: 11 +fun case_11() { + var x: Boolean? = true + do { + x = null + break + } while (x!!) + x + x.not() +} + +// TESTCASE NUMBER: 12 +fun case_12() { + var x: Boolean? = true + do { + x + x.not() + x = null + break + } while (true && x!!) + x + x.not() +} + +// TESTCASE NUMBER: 13 +fun case_13() { + var x: Boolean? = true + do { + x + x.not() + x = null + break + } while (false && x!!) + x + x.not() +} + +// TESTCASE NUMBER: 14 +fun case_14() { + var x: Boolean? = true + do { + x + x.not() + x = null + break + } while (true || x!!) + x + x.not() +} + +// TESTCASE NUMBER: 15 +fun case_15() { + var x: Boolean? = true + do { + x + x.not() + x = null + break + } while (!(false && x!!)) + x + x.not() +} + +/* + * TESTCASE NUMBER: 16 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22379, KT-28369 + */ +fun case_16() { + var x: Boolean? = true + while (x!! && if (true) {x = null; true} else true) { + break + } + x + x.not() +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22379, KT-28369 + */ +fun case_17() { + var x: Boolean? = true + while (x!! && if (true) {x = null; true} else true) { + break + } + x + x.not() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.kt new file mode 100644 index 00000000000..68b47bcf7b3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.kt @@ -0,0 +1,129 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 35 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_1() { + var x: String? + x = "Test" + println("${if (true) x = null else 1}") + x + x.length +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_2() { + var x: String? + x = "Test" + println("${try { x = null } finally { }}") + x + x.length +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_3() { + var x: String? + x = "Test" + println("${try { } finally { x = null }}") + x + x.length +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_4() { + var x: String? + x = "Test" + println("${try { x = null } catch (e: Exception) { } finally { }}") + x + x.length +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_5() { + var x: String? + x = "Test" + println("${try { } catch (e: Exception) { x = null } finally { }}") + x + x.length +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_6() { + var x: String? + x = "Test" + println("${try { } catch (e: Exception) { } finally { x = null }}") + x + x.length +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_7() { + var x: String? + x = "Test" + println("${try { x = null } catch (e: Exception) { }}") + x + x.length +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_8() { + var x: String? + x = "Test" + println("${try { } catch (e: Exception) { x = null }}") + x + x.length +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18130 + */ +fun case_9() { + var x: String? + x = "Test" + println("${when (null) { else -> x = null } }") + x + x.length +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.kt new file mode 100644 index 00000000000..05c59457ddb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.kt @@ -0,0 +1,92 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 36 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-13650 + */ +fun case_1(x: Class?, y: Any) { + x?.prop_12 = if (y is String) "" else throw Exception() + y + y.toUpperCase() +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Class?, y: Any) { + x?.prop_9 = y is String || return + y + y.toUpperCase() +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-13650 + */ +fun case_3(x: Class?, y: Any) { + x?.prop_12 = y as String + y + y.toUpperCase() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-13650 + */ +fun case_4(x: Class?, y: Any) { + x?.prop_12 = y as? String ?: return + y + y.toUpperCase() +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-13650 + */ +fun case_5(x: Class?, y: String?) { + x?.prop_12 = y ?: return + y + y.toUpperCase() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Class?, y: String?) { + x?.prop_9 = y !is String && throw Exception() + y + y.toUpperCase() +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-13650 + */ +fun case_7(x: Class?, y: String?) { + x?.prop_12 = y!! + y + y.toUpperCase() +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-13650 + */ +fun case_8(x: Class?, y: String?) { + x?.prop_12 = if (y === null) throw Exception() else "" + y + y.toUpperCase() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.kt new file mode 100644 index 00000000000..28d6eda7a54 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.kt @@ -0,0 +1,118 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 37 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7630 + */ +fun case_1() { + var x: Class? = Class() + if (x != null) { + x + x++ + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7630 + */ +fun case_2() { + var x: Class? + x = Class() + x + x-- + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7630 + */ +fun case_3() { + var x: Class? = Class() + x!! + x + --x + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7630 + */ +fun case_4() { + var x: Class? = Class() + x as Class + x + ++x + x + x.equals(10) +} + +// TESTCASE NUMBER: 5 +fun case_5() { + var x: Class? = Class() + x as Class + x + x = x + x + x + x.equals(10) +} + +// TESTCASE NUMBER: 6 +fun case_6() { + var x: Class? = Class() + if (x is Class) { + x + x = x - x + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7630 + */ +fun case_7() { + var x: Class? + x = Class() + x + x += x + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7630 + */ +fun case_8() { + var x: Class? = Class() + x!! + x + x -= x + x + x.equals(10) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.kt new file mode 100644 index 00000000000..fcb26a197a0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.kt @@ -0,0 +1,187 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 38 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22454 + */ +fun case_1() { + var x: String? = null + + outer@ while (true) { + inner@ while (x == null) { + break@outer + } + } + x + x.length +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22454 + */ +fun case_2() { + var x: String? = null + + outer@ while (true) { + inner@ while (x === null) { + break@outer + } + } + x + x.length +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22454 + */ +fun case_3(y: Nothing?) { + var x: String? = null + + outer@ while (true) { + inner@ while (x === y) { + break@outer + } + } + x + x.length +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22454 + */ +fun case_4(y: Nothing?) { + var x: String? = null + + outer1@ while (true) { + outer2@ while (x == y) { + inner@ while (true) { + break@outer1 + } + } + } + x + x.length +} + +// TESTCASE NUMBER: 5 +fun case_5(y: Nothing?) { + var x: String? = null + + outer@ while (x == null) { + inner@ while (true) { + break@outer + } + } + x + x.length +} + +// TESTCASE NUMBER: 6 +fun case_6(y: Nothing?) { + var x: String? = null + + outer1@ while (true) { + outer2@ while (x == y) { + inner@ while (true) { + break@outer2 + } + } + break + } + x + x.length +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22454 + */ +fun case_7() { + var x: String? = null + + outer@ do { + inner@ do { + break@outer + } while (x == null) + } while (true) + x + x.length +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22454 + */ +fun case_8(y: Nothing?) { + var x: String? = null + + outer1@ do { + outer2@ do { + inner@ do { + break@outer1 + } while (true) + } while (x === y) + } while (true) + x + x.length +} + +// TESTCASE NUMBER: 9 +fun case_9() { + var x: String? = null + + outer@ while (x != null) { + inner@ do { + x = null + } while (x != null) + x + x.length + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + var x: String? = null + + outer@ while (x != null) { + inner@ do { + x = null + } while (true) + x + x.length + } +} + +// TESTCASE NUMBER: 11 +fun case_11() { + var x: String? = null + + outer@ while (x != null) { + inner@ do { + x = null + break + } while (x == null) + x + x.length + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.kt new file mode 100644 index 00000000000..154169aea62 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.kt @@ -0,0 +1,176 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 39 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24652 + */ +fun case_1() { + val x: String? = null + while (true) { + println(x ?: break) + } + x + x.length +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24652 + */ +fun case_2(y: MutableList) { + val x: Int? = null + while (true) { + y[x ?: break] = 10 + } + x + x.inv() +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24652 + */ +fun case_3(y: MutableList) { + val x: Int? = null + while (true) { + y[0] = x ?: break + } + x + x.inv() +} + +// TESTCASE NUMBER: 4 +fun case_4() { + val x: Int? = null + while (true) { + x ?: break + } + x + x.inv() +} + +// TESTCASE NUMBER: 5 +fun case_5(y: Boolean) { + val x: Boolean? = null + while (true) { + y && (x ?: break) + } + x + x.not() +} + +// TESTCASE NUMBER: 6 +fun case_6(y: Boolean) { + val x: Boolean? = null + while (true) { + y || (x ?: break) + } + x + x.not() +} + +// TESTCASE NUMBER: 7 +fun case_7(y: Boolean?) { + val x: Boolean? = null + while (true) { + y ?: x ?: break + } + x + x.not() +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24652 + */ +fun case_8() { + var y: Int = 10 + val x: Int? = null + while (true) { + y += x ?: break + } + x + x.inv() +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24652 + */ +fun case_9() { + var y: Int = 10 + val x: Int? = null + while (true) { + y -= x ?: break + } + x + x.inv() +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24652 + */ +fun case_10() { + var y: Int = 10 + val x: Int? = null + while (true) { + val z = y - (x ?: break) + } + x + x.inv() +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24652 + */ +fun case_11() { + var y: Int = 10 + val x: Int? = null + while (true) { + val z = y * (x ?: break) + } + x + x.inv() +} + +// TESTCASE NUMBER: 12 +fun case_12() { + var y: Int = 10 + val x: Int? = null + while (true) { + y += if (x == null) break else 10 + } + x + x.inv() +} + +// TESTCASE NUMBER: 13 +fun case_13() { + var y: Int = 10 + val x: Int? = null + while (true) { + val z = y * if (x != null) break else 10 + } + x + x.inv() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt new file mode 100644 index 00000000000..8a6703de417 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt @@ -0,0 +1,194 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 4 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: properties, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Int is Boolean) { + x + x.inv() + x.not() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any?) { + if (x is Int is Any? is Boolean) { + x + x.inv() + x.not() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 3 +inline fun case_3(x: Any?) { + if (x is Int is T) { + x + x.inv() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 4 +inline fun Boolean>case_4(x: Any?) { + if (x is Int is T == null) { + x + x.inv() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (x is Int != null) { + x + x.inv() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (x is Int == null) { + x + x.inv() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any?) { + if (!(x !is Int) == false) { + x + x.inv() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (!(x !is Int) == true) else { + x + x.inv() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (x !is Int !is Any?) { + x + x.inv() + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 10 +inline fun case_10(x: Any?) { + if (x is T is K is L) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 11 +inline fun case_11(x: Any?) { + if (x is Int !is K !is T !is L) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 12 +inline fun case_12(x: Any?) { + if (x !is K !is T !is L) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 13 +inline fun case_13(x: Any?) { + if (!(x !is K !is T !is L)) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 14 +inline fun case_14(x: Any?) { + if (!(x !is T is Boolean)) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 15 +inline fun case_15(x: Any?) { + if (!(x !is T) is Boolean) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 16 +inline fun case_16(x: Any?) { + if (((x is K) is T) is L) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 17 +inline fun case_17(x: Any?) { + if (x is T is T) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 18 +inline fun case_18(x: Any?) { + if (x !is T is T) { + x + x.propAny + x.funAny() + } +} + +// TESTCASE NUMBER: 19 +inline fun case_19(x: Any?) { + if (x is T !is T) { + x + x.propAny + x.funAny() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.kt new file mode 100644 index 00000000000..2418b50f237 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.kt @@ -0,0 +1,32 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 40 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-8819 + */ +fun case_1(x: Pair<*, *>) { + if (x.first !is String) return + x.first + x.first.length +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-8819 + */ +fun case_2(x: Pair<*, *>) { + if (x.first !is String?) throw Exception() + x.first + x.first?.length +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.kt new file mode 100644 index 00000000000..e10cb2f8690 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.kt @@ -0,0 +1,98 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 41 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +inline fun case_1(x: Any?) { + when (x) { + is T -> { + x + x.equals(10) + } + else -> return + } + x + x.equals(10) +} + +// TESTCASE NUMBER: 2 +inline fun case_2(x: Any?) { + when (x) { + is Any -> { + x + x.equals(10) + } + is T -> { + x + x.equals(10) + } + else -> return + } + x + x.equals(10) +} + +// TESTCASE NUMBER: 3 +inline fun case_3(x: Any?) { + when (x) { + is T? -> return + else -> { + x + x.equals(10) + } + } + x + x.equals(10) +} + +// TESTCASE NUMBER: 4 +inline fun case_4(x: Any?) { + when (x) { + is T -> return + else -> { + x + x.equals(10) + } + } + x + x.equals(10) +} + +// TESTCASE NUMBER: 5 +inline fun case_5(x: Any?) { + if (x is T) { + x + x.equals(10) + } else return + x + x.equals(10) +} + +// TESTCASE NUMBER: 6 +inline fun case_6(x: Any?) { + if (x is T?) return + x + x.equals(10) +} + +// TESTCASE NUMBER: 7 +inline fun case_7(x: Any?) { + if (x is Any) { + x + x.equals(10) + } else if (x is T) { + x + x.equals(10) + } else return + x + x.equals(10) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt new file mode 100644 index 00000000000..daba37cebb9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt @@ -0,0 +1,168 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 42 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-1982 + */ +fun case_1(x: Any) { + if (x is Int || x is Float) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-1982 + */ +fun case_2(x: Any?) { + if (x is Int || x is Float?) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-1982 + */ +fun case_3(x: Any?) { + if (x is Int? || x is Float) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-1982 + */ +fun case_4(x: Any?) { + if (x is Int? || x is Float?) { + x + x?.toByte() + } +} + +/* + * TESTCASE NUMBER: 5 + * ISSUES: KT-1982 + */ +fun case_5(x: Any?) { + if (x is Int || x is Float) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 6 + * ISSUES: KT-1982 + */ +fun case_6(x: T) { + if (x is Int || x is Float) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 7 + * ISSUES: KT-1982 + */ +fun case_7(x: T) { + if (x is Int? || x is Float?) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 8 + * ISSUES: KT-1982 + */ +inline fun case_8(x: T) { + if (x is Int? || x is Float?) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 9 + * ISSUES: KT-1982 + */ +inline fun case_9(x: T) { + if (x is Int? || x is Float?) { + x + x.toByte() + } +} + +/* + * TESTCASE NUMBER: 10 + * ISSUES: KT-1982 + */ +inline fun case_10(x: T) { + if (x is ClassLevel2 || x is ClassLevel21 || x is ClassLevel22 || x is ClassLevel23) { + x + x.test1() + } +} + +/* + * TESTCASE NUMBER: 11 + * ISSUES: KT-1982 + */ +inline fun case_11(x: T) { + if (x !is ClassLevel2 && x !is ClassLevel21 && x !is ClassLevel22 && x !is ClassLevel23) return + x + x.test1() +} + +/* + * TESTCASE NUMBER: 12 + * ISSUES: KT-1982 + */ +fun case_12(x: Any) { + if (x !is Int && x !is Float) return + x + x.toByte() +} + +/* + * TESTCASE NUMBER: 13 + * ISSUES: KT-1982 + */ +fun case_13(x: T) { + if (x !is Int && x !is Float) throw Exception() + x + x.toByte() +} + +/* + * TESTCASE NUMBER: 14 + * ISSUES: KT-1982 + */ +fun case_14(x: Any) { + if (x is Int || x is Float) { + if (x is Float) { + x + x.NaN + } else { + x + x.inv() + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt new file mode 100644 index 00000000000..d27d635747f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt @@ -0,0 +1,90 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 43 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-10461 + */ +fun case_1(x: Double?, y: Double?) : Double { + return if (x == null && y == null) { + 0.0 + } else if (x != null && y == null) { + x + } else if (x == null && y != null) { + y + } else { + x + y + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-8781 + */ +fun case_2(x: Boolean?, y: Any?) { + if (x == true) return + if (x == false) return + if (y != x) { + y + y.equals(10) + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-8781 + */ +fun case_3(x : Unit?, y : Any?) { + if (x == kotlin.Unit) return + if (y != x) { + y + y.equals(10) + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-8781 + */ +fun case_4(x : EnumClassSingle?, y : Any?) { + if (x == EnumClassSingle.EVERYTHING) return + if (y != x) { + y + y.equals(10) + } +} + +/* + * TESTCASE NUMBER: 5 + * ISSUES: KT-18950 + */ +fun case_5(x: SealedClass) { + when (x) { + is SealedChild1 -> x.number + is SealedChild2 -> x.e1 + x.e2 + else -> x.m1 + x.m1 + } +} + +/* + * TESTCASE NUMBER: 6 + * ISSUES: KT-18950 + */ +fun case_6(x: SealedClass?) { + when (x) { + is SealedChild1 -> x.number + is SealedChild2 -> x.e1 + x.e2 + null -> {} + else -> x.m1 + x.m1 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt new file mode 100644 index 00000000000..0a99451b8a3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt @@ -0,0 +1,56 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 44 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-25747 + */ +fun case_1(x: Int?) { + val y = x != null + if (y) { + x.inv() + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-25747 + */ +fun case_2(x: Any?) { + val y = x is Int + if (y) { + x.inv() + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-25747 + */ +fun case_3(x: T) { + val y = x is Int + if (y) { + x.inv() + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-25747 + */ +fun case_4(x: T) { + val y = x is Int? + if (y) { + x?.inv() + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.kt new file mode 100644 index 00000000000..11384270907 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.kt @@ -0,0 +1,30 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 45 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-22996 + */ +fun case_1(x: Number?): Long? { + if (x is Long?) return x + x + return x.toLong() +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-22997 + */ +fun case_2(x: Number?): Long? { + if (x == null || x is Long) return x else return 0L +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.kt new file mode 100644 index 00000000000..1d239a2ab71 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.kt @@ -0,0 +1,22 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 5 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +class Case1 { + inline fun case_1(x: Any?) { + if (x is T) { + x + x.toByte() + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt new file mode 100644 index 00000000000..0bcb08ece9b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt @@ -0,0 +1,150 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 6 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Int || x !is Int) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any) { + if (x is Number || x !is Number || x is Number) { + x + x.toByte() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x is Boolean || x !is Boolean is Boolean) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any) { + if (x !is EnumClass || x !is EnumClass || x is EnumClass || x is EnumClass) { + x + x.fun_1() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (!(x !is Class.NestedClass?) || x is Class.NestedClass? || x !is Class.NestedClass?) { + if (!!(x !is Class.NestedClass?)) { + x + x.prop_4 + } + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (!(x is Object) || !!(x !is Object)) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any) { + if (!(x is DeepObject.A.B.C.D.E.F.G.J) || !!!!!!(x is DeepObject.A.B.C.D.E.F.G.J)) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (x is Int? == x is Int?) else { + x + x?.inv() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (!!!(x !is TypealiasNullableStringIndirect?)) else { + if (!(x !is TypealiasNullableStringIndirect?)) else { + x + x?.get(0) + } + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + if (!!(x !is Interface3)) { + if (!!!(x is Interface3)) { + x + x.itest() + x.itest3() + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + if (x is SealedMixedChildObject1?) else { + if (x is SealedMixedChildObject1?) else { + x + x?.prop_1 + x?.prop_2 + } + } +} + +// TESTCASE NUMBER: 12 +inline fun case_12(x: Any?) { + if (x !is T) { + if (x is T is K) { + x + x.equals(10) + } + } +} + +// TESTCASE NUMBER: 13 +inline fun case_13(x: Any?) { + if (x !is T) { + if (x !is K) { + x + x.equals(10) + } + } +} + +// TESTCASE NUMBER: 14 +inline fun case_14(x: Any?) { + if (x is K) else { + if (x !is T) { + x + x.equals(10) + } + } +} + +// TESTCASE NUMBER: 15 +inline fun case_15(x: Any?) { + if (x !is T) { + if (x is K) else { + x + x.equals(10) + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.kt new file mode 100644 index 00000000000..91d167c64f4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.kt @@ -0,0 +1,60 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 7 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Int?) { + if ((x is Int) ?: (x is Int)) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Int?) { + if (x?.equals(1) ?: x is Int) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Boolean?) { + if (x ?: (x != null)) { + x + x.not() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Boolean?) { + if (if (x != null) x else x != null) { + x + x.not() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (if (x is String) true else false) { + x + x.length + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if ((if (x != null) true else null) != null) { + x + x.length + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.kt new file mode 100644 index 00000000000..a0ad4bd5bdd --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.kt @@ -0,0 +1,50 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 8 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Class?) { + if (x?.fun_4()?.fun_4()?.fun_4()?.fun_4() != null) { + x + x.fun_4() + x.fun_4().fun_4() + x.fun_4().fun_4().fun_4() + x.fun_4().fun_4().fun_4().fun_4() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Class?) { + if (x?.fun_4()?.prop_8 != null) { + x + x.fun_4() + x.fun_4().prop_8 + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Class?) { + if (x?.prop_8?.fun_4() != null) { + x + x.prop_8 + x.prop_8.fun_4().prop_8 + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Class?) { + if (x?.prop_8.also { } != null) { + x + x.prop_8 + x.prop_8.fun_4() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.kt new file mode 100644 index 00000000000..a86c6daec94 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (NEGATIVE) + * + * SECTIONS: dfa + * NUMBER: 9 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: T?, y: K?) { + x as T + y as K + val z = x ?: y + + x.equals(10) + z + z.equals(10) +} + +// TESTCASE NUMBER: 1 +inline fun case_2(y: K?) { + y as K + + y + y.equals(10) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt new file mode 100644 index 00000000000..e6ccb7a8f21 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt @@ -0,0 +1,4231 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 1 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, functions, typealiases, properties, enumClasses + */ + +// FILE: other_package.kt + +package otherpackage + +// TESTCASE NUMBER: 13 +class Case13 {} + +// TESTCASE NUMBER: 14 +typealias Case14 = String? + +// FILE: main.kt + +import otherpackage.* + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28159 + */ +fun case_2(x: Nothing?) { + if (x !== null) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + if (Object.prop_1 == null) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Char?) { + if (x != null && true) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Unit? = null + + if (x !== null) x + if (x !== null) x.equals(null) + if (x !== null) x.propT + if (x !== null) x.propAny + if (x !== null) x.propNullableT + if (x !== null) x.propNullableAny + if (x !== null) x.funT() + if (x !== null) x.funAny() + if (x !== null) x.funNullableT() + if (x !== null) x.funNullableAny() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: EmptyClass?) { + val y = true + + if (x != null && !y) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + if (nullableNumberProperty != null || nullableNumberProperty != null) { + nullableNumberProperty + nullableNumberProperty.equals(null) + nullableNumberProperty.propT + nullableNumberProperty.propAny + nullableNumberProperty.propNullableT + nullableNumberProperty.propNullableAny + nullableNumberProperty.funT() + nullableNumberProperty.funAny() + nullableNumberProperty.funNullableT() + nullableNumberProperty.funNullableAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: TypealiasNullableString) { + if (x !== null && x != null) x + if (x !== null && x != null) x.equals(null) + if (x !== null && x != null) x.propT + if (x !== null && x != null) x.propAny + if (x !== null && x != null) x.propNullableT + if (x !== null && x != null) x.propNullableAny + if (x !== null && x != null) x.funT() + if (x !== null && x != null) x.funAny() + if (x !== null && x != null) x.funNullableT() + if (x !== null && x != null) x.funNullableAny() +} + +// TESTCASE NUMBER: 9 +fun case_9(x: TypealiasNullableString?) { + if (x === null) { + + } else if (false) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + val a = Class() + + if (a.prop_4 === null || true) { + if (a.prop_4 != null) { + a.prop_4 + a.prop_4.equals(null) + a.prop_4.propT + a.prop_4.propAny + a.prop_4.propNullableT + a.prop_4.propNullableAny + a.prop_4.funT() + a.prop_4.funAny() + a.prop_4.funNullableT() + a.prop_4.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: TypealiasNullableStringIndirect?, y: TypealiasNullableStringIndirect) { + val t: TypealiasNullableStringIndirect = null + + if (x == null) { + + } else { + if (y != null) { + if (nullableStringProperty == null) { + if (t != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: TypealiasNullableStringIndirect, y: TypealiasNullableStringIndirect) = + if (x == null) "1" + else if (y === null) x + else if (y === null) x.equals(null) + else if (y === null) x.propT + else if (y === null) x.propAny + else if (y === null) x.propNullableT + else if (y === null) x.propNullableAny + else if (y === null) x.funT() + else if (y === null) x.funAny() + else if (y === null) x.funNullableT() + else if (y === null) x.funNullableAny() + else "-1" + +// TESTCASE NUMBER: 13 +fun case_13(x: otherpackage.Case13?) = + if (x == null) { + throw Exception() + } else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + +// TESTCASE NUMBER: 14 +class Case14 { + val x: otherpackage.Case14? + init { + x = otherpackage.Case14() + } +} + +fun case_14() { + val a = Case14() + + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x !== null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: EmptyObject) { + val t = if (x === null) "" else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 16 +fun case_16() { + val x: TypealiasNullableNothing = null + + if (x != null) { + x + } +} + +// TESTCASE NUMBER: 17 +val case_17 = if (nullableIntProperty == null) 0 else { + nullableIntProperty + nullableIntProperty.equals(null) + nullableIntProperty.propT + nullableIntProperty.propAny + nullableIntProperty.propNullableT + nullableIntProperty.propNullableAny + nullableIntProperty.funT() + nullableIntProperty.funAny() + nullableIntProperty.funNullableT() + nullableIntProperty.funNullableAny() +} + +//TESTCASE NUMBER: 18 +fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?) { + if (a != null) { + a + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } +} + +// TESTCASE NUMBER: 19 +fun case_19(b: Boolean) { + val a = if (b) { + object { + val B19 = if (b) { + object { + val C19 = if (b) { + object { + val D19 = if (b) { + object { + val x: Number? = 10 + } + } else null + } + } else null + } + } else null + } + } else null + + if (a != null && a.B19 != null && a.B19.C19 != null && a.B19.C19.D19 != null && a.B19.C19.D19.x != null) { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 20 +fun case_20(b: Boolean) { + val a = object { + val B19 = object { + val C19 = object { + val D19 = if (b) { + object {} + } else null + } + } + } + + if (a.B19.C19.D19 !== null) { + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19 + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.equals(null) + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.propT + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.propAny + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.propNullableT + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.propNullableAny + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.funT() + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.funAny() + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.funNullableT() + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.funNullableAny() + } +} + +// TESTCASE NUMBER: 21 +fun case_21() { + if (EnumClassWithNullableProperty.B.prop_1 !== null) { + EnumClassWithNullableProperty.B.prop_1 + EnumClassWithNullableProperty.B.prop_1.equals(null) + EnumClassWithNullableProperty.B.prop_1.propT + EnumClassWithNullableProperty.B.prop_1.propAny + EnumClassWithNullableProperty.B.prop_1.propNullableT + EnumClassWithNullableProperty.B.prop_1.propNullableAny + EnumClassWithNullableProperty.B.prop_1.funT() + EnumClassWithNullableProperty.B.prop_1.funAny() + EnumClassWithNullableProperty.B.prop_1.funNullableT() + EnumClassWithNullableProperty.B.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 22 +fun case_22(a: (() -> Unit)?) { + if (a != null) { + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().equals(null) + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().propT + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().propAny + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().propNullableT + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().propNullableAny + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().funT() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().funAny() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().funNullableT() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a().funNullableAny() + } +} + +// TESTCASE NUMBER: 23 +fun case_23(a: ((Float) -> Int?)?, b: Float?) { + if (a != null && b !== null) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 24 +fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = + if (a !== null && b !== null) { + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a( kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b) + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a(b) + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.equals(null) + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.propT + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.propAny + kotlin.Unit)? & () -> kotlin.Unit")!>b.propNullableT + kotlin.Unit)? & () -> kotlin.Unit")!>b.propNullableAny + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.funT() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.funAny() + kotlin.Unit)? & () -> kotlin.Unit")!>b.funNullableT() + kotlin.Unit)? & () -> kotlin.Unit")!>b.funNullableAny() + } else null + +// TESTCASE NUMBER: 25 +fun case_25(b: Boolean) { + val x = { + if (b) object { + val a = 10 + } else null + } + + val y = if (b) x else null + + if (y !== null) { + val z = .?")!> case_25..?)? & () -> case_25..?"), DEBUG_INFO_SMARTCAST!>y() + + if (z != null) { + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.equals(null) + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.propT + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.propAny + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.propNullableT + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.propNullableAny + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.funT() + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.funAny() + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.funNullableT() + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 26 +fun case_26(a: ((Float) -> Int?)?, b: Float?) { + if (a != null == true && b != null == true) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (x != null == true) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 27 +fun case_27() { + if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} + +//TESTCASE NUMBER: 28 +fun case_28(a: DeepObject.A.B.C.D.E.F.G.J?) = + if (a != null == true == false == false == false == true == false == true == false == false == true == true) { + a.x + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } else -1 + +// TESTCASE NUMBER: 29 +open class Case29(a: Int?, val b: Float?, private val c: Unit?, protected val d: String?, internal val e: Char?, public val f: Any?) { + val x: Char? = '.' + private val y: Unit? = kotlin.Unit + protected val z: Int? = 12 + public val u: String? = "..." + val s: Any? + val v: Int? + val w: Number? + val t: String? = if (u != null) this.u else null + + init { + if (a != null) a.equals(null) + if (a != null) a.propT + if (a != null) a.propAny + if (a != null) a.propNullableT + if (a != null) a.propNullableAny + if (a != null) a.funT() + if (a != null) a.funAny() + if (a != null) a.funNullableT() + if (a != null) a.funNullableAny() + if (a != null) a + + if (b != null) b.equals(null) + + if (b != null) b.propT + + if (b != null) b.propAny + + if (b != null) b.propNullableT + + if (b != null) b.propNullableAny + + if (b != null) b.funT() + + if (b != null) b.funAny() + + if (b != null) b.funNullableT() + + if (b != null) b.funNullableAny() + if (b != null) b + if (this.b != null) this.b + if (this.b != null) this.b.equals(null) + if (this.b != null) this.b.propT + if (this.b != null) this.b.propAny + if (this.b != null) this.b.propNullableT + if (this.b != null) this.b.propNullableAny + if (this.b != null) this.b.funT() + if (this.b != null) this.b.funAny() + if (this.b != null) this.b.funNullableT() + if (this.b != null) this.b.funNullableAny() + if (this.b != null) b + if (this.b != null) b.equals(null) + if (this.b != null) b.propT + if (this.b != null) b.propAny + if (this.b != null) b.propNullableT + if (this.b != null) b.propNullableAny + if (this.b != null) b.funT() + if (this.b != null) b.funAny() + if (this.b != null) b.funNullableT() + if (this.b != null) b.funNullableAny() + if (b != null) this.b + if (b != null) this.b.equals(null) + if (b != null) this.b.propT + if (b != null) this.b.propAny + if (b != null) this.b.propNullableT + if (b != null) this.b.propNullableAny + if (b != null) this.b.funT() + if (b != null) this.b.funAny() + if (b != null) this.b.funNullableT() + if (b != null) this.b.funNullableAny() + if (b != null || this.b != null) b.equals(null) + if (b != null || this.b != null) b.propT + if (b != null || this.b != null) b.propAny + if (b != null || this.b != null) b.propNullableT + if (b != null || this.b != null) b.propNullableAny + if (b != null || this.b != null) b.funT() + if (b != null || this.b != null) b.funAny() + if (b != null || this.b != null) b.funNullableT() + if (b != null || this.b != null) b.funNullableAny() + if (b != null || this.b != null) b + if (b != null || this.b != null) this.b.equals(null) + if (b != null || this.b != null) this.b.propT + if (b != null || this.b != null) this.b.propAny + if (b != null || this.b != null) this.b.propNullableT + if (b != null || this.b != null) this.b.propNullableAny + if (b != null || this.b != null) this.b.funT() + if (b != null || this.b != null) this.b.funAny() + if (b != null || this.b != null) this.b.funNullableT() + if (b != null || this.b != null) this.b.funNullableAny() + if (b != null || this.b != null) this.b + + if (c != null) c.equals(null) + + if (c != null) c.propT + + if (c != null) c.propAny + + if (c != null) c.propNullableT + + if (c != null) c.propNullableAny + + if (c != null) c.funT() + + if (c != null) c.funAny() + + if (c != null) c.funNullableT() + + if (c != null) c.funNullableAny() + if (c != null) c + if (this.c != null) this.c.equals(null) + if (this.c != null) this.c.propT + if (this.c != null) this.c.propAny + if (this.c != null) this.c.propNullableT + if (this.c != null) this.c.propNullableAny + if (this.c != null) this.c.funT() + if (this.c != null) this.c.funAny() + if (this.c != null) this.c.funNullableT() + if (this.c != null) this.c.funNullableAny() + if (this.c != null) this.c + if (c != null) this.c.equals(null) + if (c != null) this.c.propT + if (c != null) this.c.propAny + if (c != null) this.c.propNullableT + if (c != null) this.c.propNullableAny + if (c != null) this.c.funT() + if (c != null) this.c.funAny() + if (c != null) this.c.funNullableT() + if (c != null) this.c.funNullableAny() + if (c != null) this.c + if (this.c != null) c.equals(null) + if (this.c != null) c.propT + if (this.c != null) c.propAny + if (this.c != null) c.propNullableT + if (this.c != null) c.propNullableAny + if (this.c != null) c.funT() + if (this.c != null) c.funAny() + if (this.c != null) c.funNullableT() + if (this.c != null) c.funNullableAny() + if (this.c != null) c + if (c != null || this.c != null) c.equals(null) + if (c != null || this.c != null) c.propT + if (c != null || this.c != null) c.propAny + if (c != null || this.c != null) c.propNullableT + if (c != null || this.c != null) c.propNullableAny + if (c != null || this.c != null) c.funT() + if (c != null || this.c != null) c.funAny() + if (c != null || this.c != null) c.funNullableT() + if (c != null || this.c != null) c.funNullableAny() + if (c != null || this.c != null) c + if (c != null || this.c != null) this.c.equals(null) + if (c != null || this.c != null) this.c.propT + if (c != null || this.c != null) this.c.propAny + if (c != null || this.c != null) this.c.propNullableT + if (c != null || this.c != null) this.c.propNullableAny + if (c != null || this.c != null) this.c.funT() + if (c != null || this.c != null) this.c.funAny() + if (c != null || this.c != null) this.c.funNullableT() + if (c != null || this.c != null) this.c.funNullableAny() + if (c != null || this.c != null) this.c + + if (d != null) d.equals(null) + + if (d != null) d.propT + + if (d != null) d.propAny + + if (d != null) d.propNullableT + + if (d != null) d.propNullableAny + + if (d != null) d.funT() + + if (d != null) d.funAny() + + if (d != null) d.funNullableT() + + if (d != null) d.funNullableAny() + if (d != null) d + if (this.d != null) this.d.equals(null) + if (this.d != null) this.d.propT + if (this.d != null) this.d.propAny + if (this.d != null) this.d.propNullableT + if (this.d != null) this.d.propNullableAny + if (this.d != null) this.d.funT() + if (this.d != null) this.d.funAny() + if (this.d != null) this.d.funNullableT() + if (this.d != null) this.d.funNullableAny() + if (this.d != null) this.d + if (d != null) this.d.equals(null) + if (d != null) this.d.propT + if (d != null) this.d.propAny + if (d != null) this.d.propNullableT + if (d != null) this.d.propNullableAny + if (d != null) this.d.funT() + if (d != null) this.d.funAny() + if (d != null) this.d.funNullableT() + if (d != null) this.d.funNullableAny() + if (d != null) this.d + if (this.d != null) d.equals(null) + if (this.d != null) d.propT + if (this.d != null) d.propAny + if (this.d != null) d.propNullableT + if (this.d != null) d.propNullableAny + if (this.d != null) d.funT() + if (this.d != null) d.funAny() + if (this.d != null) d.funNullableT() + if (this.d != null) d.funNullableAny() + if (this.d != null) d + if (d != null || this.d != null) d.equals(null) + if (d != null || this.d != null) d.propT + if (d != null || this.d != null) d.propAny + if (d != null || this.d != null) d.propNullableT + if (d != null || this.d != null) d.propNullableAny + if (d != null || this.d != null) d.funT() + if (d != null || this.d != null) d.funAny() + if (d != null || this.d != null) d.funNullableT() + if (d != null || this.d != null) d.funNullableAny() + if (d != null || this.d != null) d + if (d != null || this.d != null) this.d.equals(null) + if (d != null || this.d != null) this.d.propT + if (d != null || this.d != null) this.d.propAny + if (d != null || this.d != null) this.d.propNullableT + if (d != null || this.d != null) this.d.propNullableAny + if (d != null || this.d != null) this.d.funT() + if (d != null || this.d != null) this.d.funAny() + if (d != null || this.d != null) this.d.funNullableT() + if (d != null || this.d != null) this.d.funNullableAny() + if (d != null || this.d != null) this.d + + if (e != null) e.equals(null) + + if (e != null) e.propT + + if (e != null) e.propAny + + if (e != null) e.propNullableT + + if (e != null) e.propNullableAny + + if (e != null) e.funT() + + if (e != null) e.funAny() + + if (e != null) e.funNullableT() + + if (e != null) e.funNullableAny() + if (e != null) e + if (this.e != null) this.e.equals(null) + if (this.e != null) this.e.propT + if (this.e != null) this.e.propAny + if (this.e != null) this.e.propNullableT + if (this.e != null) this.e.propNullableAny + if (this.e != null) this.e.funT() + if (this.e != null) this.e.funAny() + if (this.e != null) this.e.funNullableT() + if (this.e != null) this.e.funNullableAny() + if (this.e != null) this.e + if (this.e != null) e.equals(null) + if (this.e != null) e.propT + if (this.e != null) e.propAny + if (this.e != null) e.propNullableT + if (this.e != null) e.propNullableAny + if (this.e != null) e.funT() + if (this.e != null) e.funAny() + if (this.e != null) e.funNullableT() + if (this.e != null) e.funNullableAny() + if (this.e != null) e + if (e != null) this.e.equals(null) + if (e != null) this.e.propT + if (e != null) this.e.propAny + if (e != null) this.e.propNullableT + if (e != null) this.e.propNullableAny + if (e != null) this.e.funT() + if (e != null) this.e.funAny() + if (e != null) this.e.funNullableT() + if (e != null) this.e.funNullableAny() + if (e != null) this.e + if (e != null || this.e != null) e.equals(null) + if (e != null || this.e != null) e.propT + if (e != null || this.e != null) e.propAny + if (e != null || this.e != null) e.propNullableT + if (e != null || this.e != null) e.propNullableAny + if (e != null || this.e != null) e.funT() + if (e != null || this.e != null) e.funAny() + if (e != null || this.e != null) e.funNullableT() + if (e != null || this.e != null) e.funNullableAny() + if (e != null || this.e != null) e + if (e != null || this.e != null) this.e.equals(null) + if (e != null || this.e != null) this.e.propT + if (e != null || this.e != null) this.e.propAny + if (e != null || this.e != null) this.e.propNullableT + if (e != null || this.e != null) this.e.propNullableAny + if (e != null || this.e != null) this.e.funT() + if (e != null || this.e != null) this.e.funAny() + if (e != null || this.e != null) this.e.funNullableT() + if (e != null || this.e != null) this.e.funNullableAny() + if (e != null || this.e != null) this.e + + if (f != null) f.equals(null) + + if (f != null) f.propT + + if (f != null) f.propAny + + if (f != null) f.propNullableT + + if (f != null) f.propNullableAny + + if (f != null) f.funT() + + if (f != null) f.funAny() + + if (f != null) f.funNullableT() + + if (f != null) f.funNullableAny() + if (f != null) f + if (this.f != null) this.f.equals(null) + if (this.f != null) this.f.propT + if (this.f != null) this.f.propAny + if (this.f != null) this.f.propNullableT + if (this.f != null) this.f.propNullableAny + if (this.f != null) this.f.funT() + if (this.f != null) this.f.funAny() + if (this.f != null) this.f.funNullableT() + if (this.f != null) this.f.funNullableAny() + if (this.f != null) this.f + if (this.f != null) f.equals(null) + if (this.f != null) f.propT + if (this.f != null) f.propAny + if (this.f != null) f.propNullableT + if (this.f != null) f.propNullableAny + if (this.f != null) f.funT() + if (this.f != null) f.funAny() + if (this.f != null) f.funNullableT() + if (this.f != null) f.funNullableAny() + if (this.f != null) f + if (f != null) this.f.equals(null) + if (f != null) this.f.propT + if (f != null) this.f.propAny + if (f != null) this.f.propNullableT + if (f != null) this.f.propNullableAny + if (f != null) this.f.funT() + if (f != null) this.f.funAny() + if (f != null) this.f.funNullableT() + if (f != null) this.f.funNullableAny() + if (f != null) this.f + if (f != null || this.f != null) f.equals(null) + if (f != null || this.f != null) f.propT + if (f != null || this.f != null) f.propAny + if (f != null || this.f != null) f.propNullableT + if (f != null || this.f != null) f.propNullableAny + if (f != null || this.f != null) f.funT() + if (f != null || this.f != null) f.funAny() + if (f != null || this.f != null) f.funNullableT() + if (f != null || this.f != null) f.funNullableAny() + if (f != null || this.f != null) f + if (f != null || this.f != null) this.f.equals(null) + if (f != null || this.f != null) this.f.propT + if (f != null || this.f != null) this.f.propAny + if (f != null || this.f != null) this.f.propNullableT + if (f != null || this.f != null) this.f.propNullableAny + if (f != null || this.f != null) this.f.funT() + if (f != null || this.f != null) this.f.funAny() + if (f != null || this.f != null) this.f.funNullableT() + if (f != null || this.f != null) this.f.funNullableAny() + if (f != null || this.f != null) this.f + + if (x != null) x.equals(null) + + if (x != null) x.propT + + if (x != null) x.propAny + + if (x != null) x.propNullableT + + if (x != null) x.propNullableAny + + if (x != null) x.funT() + + if (x != null) x.funAny() + + if (x != null) x.funNullableT() + + if (x != null) x.funNullableAny() + if (x != null) x + if (this.x != null) this.x.equals(null) + if (this.x != null) this.x.propT + if (this.x != null) this.x.propAny + if (this.x != null) this.x.propNullableT + if (this.x != null) this.x.propNullableAny + if (this.x != null) this.x.funT() + if (this.x != null) this.x.funAny() + if (this.x != null) this.x.funNullableT() + if (this.x != null) this.x.funNullableAny() + if (this.x != null) this.x + if (x != null) this.x.equals(null) + if (x != null) this.x.propT + if (x != null) this.x.propAny + if (x != null) this.x.propNullableT + if (x != null) this.x.propNullableAny + if (x != null) this.x.funT() + if (x != null) this.x.funAny() + if (x != null) this.x.funNullableT() + if (x != null) this.x.funNullableAny() + if (x != null) this.x + if (this.x != null) x.equals(null) + if (this.x != null) x.propT + if (this.x != null) x.propAny + if (this.x != null) x.propNullableT + if (this.x != null) x.propNullableAny + if (this.x != null) x.funT() + if (this.x != null) x.funAny() + if (this.x != null) x.funNullableT() + if (this.x != null) x.funNullableAny() + if (this.x != null) x + if (x != null || this.x != null) x.equals(null) + if (x != null || this.x != null) x.propT + if (x != null || this.x != null) x.propAny + if (x != null || this.x != null) x.propNullableT + if (x != null || this.x != null) x.propNullableAny + if (x != null || this.x != null) x.funT() + if (x != null || this.x != null) x.funAny() + if (x != null || this.x != null) x.funNullableT() + if (x != null || this.x != null) x.funNullableAny() + if (x != null || this.x != null) x + if (x != null || this.x != null) this.x.equals(null) + if (x != null || this.x != null) this.x.propT + if (x != null || this.x != null) this.x.propAny + if (x != null || this.x != null) this.x.propNullableT + if (x != null || this.x != null) this.x.propNullableAny + if (x != null || this.x != null) this.x.funT() + if (x != null || this.x != null) this.x.funAny() + if (x != null || this.x != null) this.x.funNullableT() + if (x != null || this.x != null) this.x.funNullableAny() + if (x != null || this.x != null) this.x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + if (this.y != null) this.y.equals(null) + if (this.y != null) this.y.propT + if (this.y != null) this.y.propAny + if (this.y != null) this.y.propNullableT + if (this.y != null) this.y.propNullableAny + if (this.y != null) this.y.funT() + if (this.y != null) this.y.funAny() + if (this.y != null) this.y.funNullableT() + if (this.y != null) this.y.funNullableAny() + if (this.y != null) this.y + if (this.y != null) y.equals(null) + if (this.y != null) y.propT + if (this.y != null) y.propAny + if (this.y != null) y.propNullableT + if (this.y != null) y.propNullableAny + if (this.y != null) y.funT() + if (this.y != null) y.funAny() + if (this.y != null) y.funNullableT() + if (this.y != null) y.funNullableAny() + if (this.y != null) y + if (y != null) this.y.equals(null) + if (y != null) this.y.propT + if (y != null) this.y.propAny + if (y != null) this.y.propNullableT + if (y != null) this.y.propNullableAny + if (y != null) this.y.funT() + if (y != null) this.y.funAny() + if (y != null) this.y.funNullableT() + if (y != null) this.y.funNullableAny() + if (y != null) this.y + if (y != null || this.y != null) y.equals(null) + if (y != null || this.y != null) y.propT + if (y != null || this.y != null) y.propAny + if (y != null || this.y != null) y.propNullableT + if (y != null || this.y != null) y.propNullableAny + if (y != null || this.y != null) y.funT() + if (y != null || this.y != null) y.funAny() + if (y != null || this.y != null) y.funNullableT() + if (y != null || this.y != null) y.funNullableAny() + if (y != null || this.y != null) y + if (y != null || this.y != null) this.y.equals(null) + if (y != null || this.y != null) this.y.propT + if (y != null || this.y != null) this.y.propAny + if (y != null || this.y != null) this.y.propNullableT + if (y != null || this.y != null) this.y.propNullableAny + if (y != null || this.y != null) this.y.funT() + if (y != null || this.y != null) this.y.funAny() + if (y != null || this.y != null) this.y.funNullableT() + if (y != null || this.y != null) this.y.funNullableAny() + if (y != null || this.y != null) this.y + + if (z != null) z.equals(null) + + if (z != null) z.propT + + if (z != null) z.propAny + + if (z != null) z.propNullableT + + if (z != null) z.propNullableAny + + if (z != null) z.funT() + + if (z != null) z.funAny() + + if (z != null) z.funNullableT() + + if (z != null) z.funNullableAny() + if (z != null) z + if (this.z != null) this.z.equals(null) + if (this.z != null) this.z.propT + if (this.z != null) this.z.propAny + if (this.z != null) this.z.propNullableT + if (this.z != null) this.z.propNullableAny + if (this.z != null) this.z.funT() + if (this.z != null) this.z.funAny() + if (this.z != null) this.z.funNullableT() + if (this.z != null) this.z.funNullableAny() + if (this.z != null) this.z + if (z != null) this.z.equals(null) + if (z != null) this.z.propT + if (z != null) this.z.propAny + if (z != null) this.z.propNullableT + if (z != null) this.z.propNullableAny + if (z != null) this.z.funT() + if (z != null) this.z.funAny() + if (z != null) this.z.funNullableT() + if (z != null) this.z.funNullableAny() + if (z != null) this.z + if (this.z != null) z.equals(null) + if (this.z != null) z.propT + if (this.z != null) z.propAny + if (this.z != null) z.propNullableT + if (this.z != null) z.propNullableAny + if (this.z != null) z.funT() + if (this.z != null) z.funAny() + if (this.z != null) z.funNullableT() + if (this.z != null) z.funNullableAny() + if (this.z != null) z + if (z != null || this.z != null) z + if (z != null || this.z != null) z.equals(null) + if (z != null || this.z != null) z.propT + if (z != null || this.z != null) z.propAny + if (z != null || this.z != null) z.propNullableT + if (z != null || this.z != null) z.propNullableAny + if (z != null || this.z != null) z.funT() + if (z != null || this.z != null) z.funAny() + if (z != null || this.z != null) z.funNullableT() + if (z != null || this.z != null) z.funNullableAny() + if (z != null || this.z != null) this.z + if (z != null || this.z != null) this.z.equals(null) + if (z != null || this.z != null) this.z.propT + if (z != null || this.z != null) this.z.propAny + if (z != null || this.z != null) this.z.propNullableT + if (z != null || this.z != null) this.z.propNullableAny + if (z != null || this.z != null) this.z.funT() + if (z != null || this.z != null) this.z.funAny() + if (z != null || this.z != null) this.z.funNullableT() + if (z != null || this.z != null) this.z.funNullableAny() + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + if (this.u != null) this.u.equals(null) + if (this.u != null) this.u.propT + if (this.u != null) this.u.propAny + if (this.u != null) this.u.propNullableT + if (this.u != null) this.u.propNullableAny + if (this.u != null) this.u.funT() + if (this.u != null) this.u.funAny() + if (this.u != null) this.u.funNullableT() + if (this.u != null) this.u.funNullableAny() + if (this.u != null) this.u + if (this.u != null) u.equals(null) + if (this.u != null) u.propT + if (this.u != null) u.propAny + if (this.u != null) u.propNullableT + if (this.u != null) u.propNullableAny + if (this.u != null) u.funT() + if (this.u != null) u.funAny() + if (this.u != null) u.funNullableT() + if (this.u != null) u.funNullableAny() + if (this.u != null) u + if (u != null) this.u.equals(null) + if (u != null) this.u.propT + if (u != null) this.u.propAny + if (u != null) this.u.propNullableT + if (u != null) this.u.propNullableAny + if (u != null) this.u.funT() + if (u != null) this.u.funAny() + if (u != null) this.u.funNullableT() + if (u != null) this.u.funNullableAny() + if (u != null) this.u + if (u != null || this.u != null) u.equals(null) + if (u != null || this.u != null) u.propT + if (u != null || this.u != null) u.propAny + if (u != null || this.u != null) u.propNullableT + if (u != null || this.u != null) u.propNullableAny + if (u != null || this.u != null) u.funT() + if (u != null || this.u != null) u.funAny() + if (u != null || this.u != null) u.funNullableT() + if (u != null || this.u != null) u.funNullableAny() + if (u != null || this.u != null) u + if (u != null || this.u != null) this.u.equals(null) + if (u != null || this.u != null) this.u.propT + if (u != null || this.u != null) this.u.propAny + if (u != null || this.u != null) this.u.propNullableT + if (u != null || this.u != null) this.u.propNullableAny + if (u != null || this.u != null) this.u.funT() + if (u != null || this.u != null) this.u.funAny() + if (u != null || this.u != null) this.u.funNullableT() + if (u != null || this.u != null) this.u.funNullableAny() + if (u != null || this.u != null) this.u + + v = 0 + v.equals(null) + v.propT + v.propAny + v.propNullableT + v.propNullableAny + v.funT() + v.funAny() + v.funNullableT() + v.funNullableAny() + v + if (v != null) v.equals(null) + if (v != null) v.propT + if (v != null) v.propAny + if (v != null) v.propNullableT + if (v != null) v.propNullableAny + if (v != null) v.funT() + if (v != null) v.funAny() + if (v != null) v.funNullableT() + if (v != null) v.funNullableAny() + if (v != null) v + if (this.v != null) v.equals(null) + if (this.v != null) v.propT + if (this.v != null) v.propAny + if (this.v != null) v.propNullableT + if (this.v != null) v.propNullableAny + if (this.v != null) v.funT() + if (this.v != null) v.funAny() + if (this.v != null) v.funNullableT() + if (this.v != null) v.funNullableAny() + if (this.v != null) v + if (v != null || this.v != null) v.equals(null) + if (v != null || this.v != null) v.propT + if (v != null || this.v != null) v.propAny + if (v != null || this.v != null) v.propNullableT + if (v != null || this.v != null) v.propNullableAny + if (v != null || this.v != null) v.funT() + if (v != null || this.v != null) v.funAny() + if (v != null || this.v != null) v.funNullableT() + if (v != null || this.v != null) v.funNullableAny() + if (v != null || this.v != null) v + if (v != null || this.v != null) this.v.equals(null) + if (v != null || this.v != null) this.v.propT + if (v != null || this.v != null) this.v.propAny + if (v != null || this.v != null) this.v.propNullableT + if (v != null || this.v != null) this.v.propNullableAny + if (v != null || this.v != null) this.v.funT() + if (v != null || this.v != null) this.v.funAny() + if (v != null || this.v != null) this.v.funNullableT() + if (v != null || this.v != null) this.v.funNullableAny() + if (v != null || this.v != null) this.v + + w = if (null != null) 10 else null + w + if (w != null) w.equals(null) + if (w != null) w.propT + if (w != null) w.propAny + if (w != null) w.propNullableT + if (w != null) w.propNullableAny + if (w != null) w.funT() + if (w != null) w.funAny() + if (w != null) w.funNullableT() + if (w != null) w.funNullableAny() + if (w != null) w + if (this.w != null) w.equals(null) + if (this.w != null) w.propT + if (this.w != null) w.propAny + if (this.w != null) w.propNullableT + if (this.w != null) w.propNullableAny + if (this.w != null) w.funT() + if (this.w != null) w.funAny() + if (this.w != null) w.funNullableT() + if (this.w != null) w.funNullableAny() + if (this.w != null) w + if (w != null || this.w != null) w.equals(null) + if (w != null || this.w != null) w.propT + if (w != null || this.w != null) w.propAny + if (w != null || this.w != null) w.propNullableT + if (w != null || this.w != null) w.propNullableAny + if (w != null || this.w != null) w.funT() + if (w != null || this.w != null) w.funAny() + if (w != null || this.w != null) w.funNullableT() + if (w != null || this.w != null) w.funNullableAny() + if (w != null || this.w != null) w + if (w != null || this.w != null) this.w.equals(null) + if (w != null || this.w != null) this.w.propT + if (w != null || this.w != null) this.w.propAny + if (w != null || this.w != null) this.w.propNullableT + if (w != null || this.w != null) this.w.propNullableAny + if (w != null || this.w != null) this.w.funT() + if (w != null || this.w != null) this.w.funAny() + if (w != null || this.w != null) this.w.funNullableT() + if (w != null || this.w != null) this.w.funNullableAny() + if (w != null || this.w != null) this.w + + s = null + s.hashCode() + s + if (s != null) s.java + if (s != null) s + if (this.s != null) s.java + if (this.s != null) s + if (s != null || this.s != null) s.java + if (s != null || this.s != null) s + if (s != null || this.s != null) this.s.java + if (s != null || this.s != null) this.s + } + + fun test() { + if (b != null) b.equals(null) + if (b != null) b.propT + if (b != null) b.propAny + if (b != null) b.propNullableT + if (b != null) b.propNullableAny + if (b != null) b.funT() + if (b != null) b.funAny() + if (b != null) b.funNullableT() + if (b != null) b.funNullableAny() + if (b != null) b + + if (c != null) c.equals(null) + + if (c != null) c.propT + + if (c != null) c.propAny + + if (c != null) c.propNullableT + + if (c != null) c.propNullableAny + + if (c != null) c.funT() + + if (c != null) c.funAny() + + if (c != null) c.funNullableT() + + if (c != null) c.funNullableAny() + if (c != null) c + + if (d != null) d.equals(null) + + if (d != null) d.propT + + if (d != null) d.propAny + + if (d != null) d.propNullableT + + if (d != null) d.propNullableAny + + if (d != null) d.funT() + + if (d != null) d.funAny() + + if (d != null) d.funNullableT() + + if (d != null) d.funNullableAny() + if (d != null) d + + if (e != null) e.equals(null) + + if (e != null) e.propT + + if (e != null) e.propAny + + if (e != null) e.propNullableT + + if (e != null) e.propNullableAny + + if (e != null) e.funT() + + if (e != null) e.funAny() + + if (e != null) e.funNullableT() + + if (e != null) e.funNullableAny() + if (e != null) e + + if (f != null) f.equals(null) + + if (f != null) f.propT + + if (f != null) f.propAny + + if (f != null) f.propNullableT + + if (f != null) f.propNullableAny + + if (f != null) f.funT() + + if (f != null) f.funAny() + + if (f != null) f.funNullableT() + + if (f != null) f.funNullableAny() + if (f != null) f + + if (x != null) x.equals(null) + + if (x != null) x.propT + + if (x != null) x.propAny + + if (x != null) x.propNullableT + + if (x != null) x.propNullableAny + + if (x != null) x.funT() + + if (x != null) x.funAny() + + if (x != null) x.funNullableT() + + if (x != null) x.funNullableAny() + if (x != null) x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + + if (z != null) z.equals(null) + + if (z != null) z.propT + + if (z != null) z.propAny + + if (z != null) z.propNullableT + + if (z != null) z.propNullableAny + + if (z != null) z.funT() + + if (z != null) z.funAny() + + if (z != null) z.funNullableT() + + if (z != null) z.funNullableAny() + if (z != null) z + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + + if (v != null) v.equals(null) + + if (v != null) v.propT + + if (v != null) v.propAny + + if (v != null) v.propNullableT + + if (v != null) v.propNullableAny + + if (v != null) v.funT() + + if (v != null) v.funAny() + + if (v != null) v.funNullableT() + + if (v != null) v.funNullableAny() + if (v != null) v + + if (w != null) w.equals(null) + + if (w != null) w.propT + + if (w != null) w.propAny + + if (w != null) w.propNullableT + + if (w != null) w.propNullableAny + + if (w != null) w.funT() + + if (w != null) w.funAny() + + if (w != null) w.funNullableT() + + if (w != null) w.funNullableAny() + if (w != null) w + + if (s != null) s.equals(null) + + if (s != null) s.propT + + if (s != null) s.propAny + + if (s != null) s.propNullableT + + if (s != null) s.propNullableAny + + if (s != null) s.funT() + + if (s != null) s.funAny() + + if (s != null) s.funNullableT() + + if (s != null) s.funNullableAny() + if (s != null) s + } +} + +fun case_29(a: Case29) { + if (a.x !== null) a.x.equals(null) + if (a.x !== null) a.x.propT + if (a.x !== null) a.x.propAny + if (a.x !== null) a.x.propNullableT + if (a.x !== null) a.x.propNullableAny + if (a.x !== null) a.x.funT() + if (a.x !== null) a.x.funAny() + if (a.x !== null) a.x.funNullableT() + if (a.x !== null) a.x.funNullableAny() + if (a.x !== null) a.x + if (a.b !== null) a.b.equals(null) + if (a.b !== null) a.b.propT + if (a.b !== null) a.b.propAny + if (a.b !== null) a.b.propNullableT + if (a.b !== null) a.b.propNullableAny + if (a.b !== null) a.b.funT() + if (a.b !== null) a.b.funAny() + if (a.b !== null) a.b.funNullableT() + if (a.b !== null) a.b.funNullableAny() + if (a.b !== null) a.b + if (a.e !== null) a.e.equals(null) + if (a.e !== null) a.e.propT + if (a.e !== null) a.e.propAny + if (a.e !== null) a.e.propNullableT + if (a.e !== null) a.e.propNullableAny + if (a.e !== null) a.e.funT() + if (a.e !== null) a.e.funAny() + if (a.e !== null) a.e.funNullableT() + if (a.e !== null) a.e.funNullableAny() + if (a.e !== null) a.e + if (a.f !== null) a.f.equals(null) + if (a.f !== null) a.f.propT + if (a.f !== null) a.f.propAny + if (a.f !== null) a.f.propNullableT + if (a.f !== null) a.f.propNullableAny + if (a.f !== null) a.f.funT() + if (a.f !== null) a.f.funAny() + if (a.f !== null) a.f.funNullableT() + if (a.f !== null) a.f.funNullableAny() + if (a.f !== null) a.f + if (a.v != null) a.v.equals(null) + if (a.v != null) a.v.propT + if (a.v != null) a.v.propAny + if (a.v != null) a.v.propNullableT + if (a.v != null) a.v.propNullableAny + if (a.v != null) a.v.funT() + if (a.v != null) a.v.funAny() + if (a.v != null) a.v.funNullableT() + if (a.v != null) a.v.funNullableAny() + if (a.v != null) a.v + if (a.w != null) a.w.equals(null) + if (a.w != null) a.w.propT + if (a.w != null) a.w.propAny + if (a.w != null) a.w.propNullableT + if (a.w != null) a.w.propNullableAny + if (a.w != null) a.w.funT() + if (a.w != null) a.w.funAny() + if (a.w != null) a.w.funNullableT() + if (a.w != null) a.w.funNullableAny() + if (a.w != null) a.w + if (a.s != null) a.s.equals(null) + if (a.s != null) a.s.propT + if (a.s != null) a.s.propAny + if (a.s != null) a.s.propNullableT + if (a.s != null) a.s.propNullableAny + if (a.s != null) a.s.funT() + if (a.s != null) a.s.funAny() + if (a.s != null) a.s.funNullableT() + if (a.s != null) a.s.funNullableAny() + if (a.s != null) a.s +} + +// TESTCASE NUMBER: 30 +sealed class Case30(a: Int?, val b: Float?, private val c: Unit?, protected val d: String?, internal val e: Char?, public val f: Any?) { + val x: Char? = '.' + private val y: Unit? = kotlin.Unit + protected val z: Int? = 12 + public val u: String? = "..." + val s: Any? + val v: Int? + val w: Number? + val t: String? = if (u != null) this.u else null + + init { + if (a != null) a.equals(null) + if (a != null) a.propT + if (a != null) a.propAny + if (a != null) a.propNullableT + if (a != null) a.propNullableAny + if (a != null) a.funT() + if (a != null) a.funAny() + if (a != null) a.funNullableT() + if (a != null) a.funNullableAny() + if (a != null) a + + if (b != null) b.equals(null) + + if (b != null) b.propT + + if (b != null) b.propAny + + if (b != null) b.propNullableT + + if (b != null) b.propNullableAny + + if (b != null) b.funT() + + if (b != null) b.funAny() + + if (b != null) b.funNullableT() + + if (b != null) b.funNullableAny() + if (b != null) b + if (this.b != null) this.b.equals(null) + if (this.b != null) this.b.propT + if (this.b != null) this.b.propAny + if (this.b != null) this.b.propNullableT + if (this.b != null) this.b.propNullableAny + if (this.b != null) this.b.funT() + if (this.b != null) this.b.funAny() + if (this.b != null) this.b.funNullableT() + if (this.b != null) this.b.funNullableAny() + if (this.b != null) this.b + if (this.b != null) b.equals(null) + if (this.b != null) b.propT + if (this.b != null) b.propAny + if (this.b != null) b.propNullableT + if (this.b != null) b.propNullableAny + if (this.b != null) b.funT() + if (this.b != null) b.funAny() + if (this.b != null) b.funNullableT() + if (this.b != null) b.funNullableAny() + if (this.b != null) b + if (b != null) this.b.equals(null) + if (b != null) this.b.propT + if (b != null) this.b.propAny + if (b != null) this.b.propNullableT + if (b != null) this.b.propNullableAny + if (b != null) this.b.funT() + if (b != null) this.b.funAny() + if (b != null) this.b.funNullableT() + if (b != null) this.b.funNullableAny() + if (b != null) this.b + if (b != null || this.b != null) b.equals(null) + if (b != null || this.b != null) b.propT + if (b != null || this.b != null) b.propAny + if (b != null || this.b != null) b.propNullableT + if (b != null || this.b != null) b.propNullableAny + if (b != null || this.b != null) b.funT() + if (b != null || this.b != null) b.funAny() + if (b != null || this.b != null) b.funNullableT() + if (b != null || this.b != null) b.funNullableAny() + if (b != null || this.b != null) b + if (b != null || this.b != null) this.b.equals(null) + if (b != null || this.b != null) this.b.propT + if (b != null || this.b != null) this.b.propAny + if (b != null || this.b != null) this.b.propNullableT + if (b != null || this.b != null) this.b.propNullableAny + if (b != null || this.b != null) this.b.funT() + if (b != null || this.b != null) this.b.funAny() + if (b != null || this.b != null) this.b.funNullableT() + if (b != null || this.b != null) this.b.funNullableAny() + if (b != null || this.b != null) this.b + + if (c != null) c.equals(null) + + if (c != null) c.propT + + if (c != null) c.propAny + + if (c != null) c.propNullableT + + if (c != null) c.propNullableAny + + if (c != null) c.funT() + + if (c != null) c.funAny() + + if (c != null) c.funNullableT() + + if (c != null) c.funNullableAny() + if (c != null) c + if (this.c != null) this.c.equals(null) + if (this.c != null) this.c.propT + if (this.c != null) this.c.propAny + if (this.c != null) this.c.propNullableT + if (this.c != null) this.c.propNullableAny + if (this.c != null) this.c.funT() + if (this.c != null) this.c.funAny() + if (this.c != null) this.c.funNullableT() + if (this.c != null) this.c.funNullableAny() + if (this.c != null) this.c + if (c != null) this.c.equals(null) + if (c != null) this.c.propT + if (c != null) this.c.propAny + if (c != null) this.c.propNullableT + if (c != null) this.c.propNullableAny + if (c != null) this.c.funT() + if (c != null) this.c.funAny() + if (c != null) this.c.funNullableT() + if (c != null) this.c.funNullableAny() + if (c != null) this.c + if (this.c != null) c.equals(null) + if (this.c != null) c.propT + if (this.c != null) c.propAny + if (this.c != null) c.propNullableT + if (this.c != null) c.propNullableAny + if (this.c != null) c.funT() + if (this.c != null) c.funAny() + if (this.c != null) c.funNullableT() + if (this.c != null) c.funNullableAny() + if (this.c != null) c + if (c != null || this.c != null) c.equals(null) + if (c != null || this.c != null) c.propT + if (c != null || this.c != null) c.propAny + if (c != null || this.c != null) c.propNullableT + if (c != null || this.c != null) c.propNullableAny + if (c != null || this.c != null) c.funT() + if (c != null || this.c != null) c.funAny() + if (c != null || this.c != null) c.funNullableT() + if (c != null || this.c != null) c.funNullableAny() + if (c != null || this.c != null) c + if (c != null || this.c != null) this.c.equals(null) + if (c != null || this.c != null) this.c.propT + if (c != null || this.c != null) this.c.propAny + if (c != null || this.c != null) this.c.propNullableT + if (c != null || this.c != null) this.c.propNullableAny + if (c != null || this.c != null) this.c.funT() + if (c != null || this.c != null) this.c.funAny() + if (c != null || this.c != null) this.c.funNullableT() + if (c != null || this.c != null) this.c.funNullableAny() + if (c != null || this.c != null) this.c + + if (d != null) d.equals(null) + + if (d != null) d.propT + + if (d != null) d.propAny + + if (d != null) d.propNullableT + + if (d != null) d.propNullableAny + + if (d != null) d.funT() + + if (d != null) d.funAny() + + if (d != null) d.funNullableT() + + if (d != null) d.funNullableAny() + if (d != null) d + if (this.d != null) this.d.equals(null) + if (this.d != null) this.d.propT + if (this.d != null) this.d.propAny + if (this.d != null) this.d.propNullableT + if (this.d != null) this.d.propNullableAny + if (this.d != null) this.d.funT() + if (this.d != null) this.d.funAny() + if (this.d != null) this.d.funNullableT() + if (this.d != null) this.d.funNullableAny() + if (this.d != null) this.d + if (d != null) this.d.equals(null) + if (d != null) this.d.propT + if (d != null) this.d.propAny + if (d != null) this.d.propNullableT + if (d != null) this.d.propNullableAny + if (d != null) this.d.funT() + if (d != null) this.d.funAny() + if (d != null) this.d.funNullableT() + if (d != null) this.d.funNullableAny() + if (d != null) this.d + if (this.d != null) d.equals(null) + if (this.d != null) d.propT + if (this.d != null) d.propAny + if (this.d != null) d.propNullableT + if (this.d != null) d.propNullableAny + if (this.d != null) d.funT() + if (this.d != null) d.funAny() + if (this.d != null) d.funNullableT() + if (this.d != null) d.funNullableAny() + if (this.d != null) d + if (d != null || this.d != null) d.equals(null) + if (d != null || this.d != null) d.propT + if (d != null || this.d != null) d.propAny + if (d != null || this.d != null) d.propNullableT + if (d != null || this.d != null) d.propNullableAny + if (d != null || this.d != null) d.funT() + if (d != null || this.d != null) d.funAny() + if (d != null || this.d != null) d.funNullableT() + if (d != null || this.d != null) d.funNullableAny() + if (d != null || this.d != null) d + if (d != null || this.d != null) this.d.equals(null) + if (d != null || this.d != null) this.d.propT + if (d != null || this.d != null) this.d.propAny + if (d != null || this.d != null) this.d.propNullableT + if (d != null || this.d != null) this.d.propNullableAny + if (d != null || this.d != null) this.d.funT() + if (d != null || this.d != null) this.d.funAny() + if (d != null || this.d != null) this.d.funNullableT() + if (d != null || this.d != null) this.d.funNullableAny() + if (d != null || this.d != null) this.d + + if (e != null) e.equals(null) + + if (e != null) e.propT + + if (e != null) e.propAny + + if (e != null) e.propNullableT + + if (e != null) e.propNullableAny + + if (e != null) e.funT() + + if (e != null) e.funAny() + + if (e != null) e.funNullableT() + + if (e != null) e.funNullableAny() + if (e != null) e + if (this.e != null) this.e.equals(null) + if (this.e != null) this.e.propT + if (this.e != null) this.e.propAny + if (this.e != null) this.e.propNullableT + if (this.e != null) this.e.propNullableAny + if (this.e != null) this.e.funT() + if (this.e != null) this.e.funAny() + if (this.e != null) this.e.funNullableT() + if (this.e != null) this.e.funNullableAny() + if (this.e != null) this.e + if (this.e != null) e.equals(null) + if (this.e != null) e.propT + if (this.e != null) e.propAny + if (this.e != null) e.propNullableT + if (this.e != null) e.propNullableAny + if (this.e != null) e.funT() + if (this.e != null) e.funAny() + if (this.e != null) e.funNullableT() + if (this.e != null) e.funNullableAny() + if (this.e != null) e + if (e != null) this.e.equals(null) + if (e != null) this.e.propT + if (e != null) this.e.propAny + if (e != null) this.e.propNullableT + if (e != null) this.e.propNullableAny + if (e != null) this.e.funT() + if (e != null) this.e.funAny() + if (e != null) this.e.funNullableT() + if (e != null) this.e.funNullableAny() + if (e != null) this.e + if (e != null || this.e != null) e.equals(null) + if (e != null || this.e != null) e.propT + if (e != null || this.e != null) e.propAny + if (e != null || this.e != null) e.propNullableT + if (e != null || this.e != null) e.propNullableAny + if (e != null || this.e != null) e.funT() + if (e != null || this.e != null) e.funAny() + if (e != null || this.e != null) e.funNullableT() + if (e != null || this.e != null) e.funNullableAny() + if (e != null || this.e != null) e + if (e != null || this.e != null) this.e.equals(null) + if (e != null || this.e != null) this.e.propT + if (e != null || this.e != null) this.e.propAny + if (e != null || this.e != null) this.e.propNullableT + if (e != null || this.e != null) this.e.propNullableAny + if (e != null || this.e != null) this.e.funT() + if (e != null || this.e != null) this.e.funAny() + if (e != null || this.e != null) this.e.funNullableT() + if (e != null || this.e != null) this.e.funNullableAny() + if (e != null || this.e != null) this.e + + if (f != null) f.equals(null) + + if (f != null) f.propT + + if (f != null) f.propAny + + if (f != null) f.propNullableT + + if (f != null) f.propNullableAny + + if (f != null) f.funT() + + if (f != null) f.funAny() + + if (f != null) f.funNullableT() + + if (f != null) f.funNullableAny() + if (f != null) f + if (this.f != null) this.f.equals(null) + if (this.f != null) this.f.propT + if (this.f != null) this.f.propAny + if (this.f != null) this.f.propNullableT + if (this.f != null) this.f.propNullableAny + if (this.f != null) this.f.funT() + if (this.f != null) this.f.funAny() + if (this.f != null) this.f.funNullableT() + if (this.f != null) this.f.funNullableAny() + if (this.f != null) this.f + if (this.f != null) f.equals(null) + if (this.f != null) f.propT + if (this.f != null) f.propAny + if (this.f != null) f.propNullableT + if (this.f != null) f.propNullableAny + if (this.f != null) f.funT() + if (this.f != null) f.funAny() + if (this.f != null) f.funNullableT() + if (this.f != null) f.funNullableAny() + if (this.f != null) f + if (f != null) this.f.equals(null) + if (f != null) this.f.propT + if (f != null) this.f.propAny + if (f != null) this.f.propNullableT + if (f != null) this.f.propNullableAny + if (f != null) this.f.funT() + if (f != null) this.f.funAny() + if (f != null) this.f.funNullableT() + if (f != null) this.f.funNullableAny() + if (f != null) this.f + if (f != null || this.f != null) f.equals(null) + if (f != null || this.f != null) f.propT + if (f != null || this.f != null) f.propAny + if (f != null || this.f != null) f.propNullableT + if (f != null || this.f != null) f.propNullableAny + if (f != null || this.f != null) f.funT() + if (f != null || this.f != null) f.funAny() + if (f != null || this.f != null) f.funNullableT() + if (f != null || this.f != null) f.funNullableAny() + if (f != null || this.f != null) f + if (f != null || this.f != null) this.f.equals(null) + if (f != null || this.f != null) this.f.propT + if (f != null || this.f != null) this.f.propAny + if (f != null || this.f != null) this.f.propNullableT + if (f != null || this.f != null) this.f.propNullableAny + if (f != null || this.f != null) this.f.funT() + if (f != null || this.f != null) this.f.funAny() + if (f != null || this.f != null) this.f.funNullableT() + if (f != null || this.f != null) this.f.funNullableAny() + if (f != null || this.f != null) this.f + + if (x != null) x.equals(null) + + if (x != null) x.propT + + if (x != null) x.propAny + + if (x != null) x.propNullableT + + if (x != null) x.propNullableAny + + if (x != null) x.funT() + + if (x != null) x.funAny() + + if (x != null) x.funNullableT() + + if (x != null) x.funNullableAny() + if (x != null) x + if (this.x != null) this.x.equals(null) + if (this.x != null) this.x.propT + if (this.x != null) this.x.propAny + if (this.x != null) this.x.propNullableT + if (this.x != null) this.x.propNullableAny + if (this.x != null) this.x.funT() + if (this.x != null) this.x.funAny() + if (this.x != null) this.x.funNullableT() + if (this.x != null) this.x.funNullableAny() + if (this.x != null) this.x + if (x != null) this.x.equals(null) + if (x != null) this.x.propT + if (x != null) this.x.propAny + if (x != null) this.x.propNullableT + if (x != null) this.x.propNullableAny + if (x != null) this.x.funT() + if (x != null) this.x.funAny() + if (x != null) this.x.funNullableT() + if (x != null) this.x.funNullableAny() + if (x != null) this.x + if (this.x != null) x.equals(null) + if (this.x != null) x.propT + if (this.x != null) x.propAny + if (this.x != null) x.propNullableT + if (this.x != null) x.propNullableAny + if (this.x != null) x.funT() + if (this.x != null) x.funAny() + if (this.x != null) x.funNullableT() + if (this.x != null) x.funNullableAny() + if (this.x != null) x + if (x != null || this.x != null) x.equals(null) + if (x != null || this.x != null) x.propT + if (x != null || this.x != null) x.propAny + if (x != null || this.x != null) x.propNullableT + if (x != null || this.x != null) x.propNullableAny + if (x != null || this.x != null) x.funT() + if (x != null || this.x != null) x.funAny() + if (x != null || this.x != null) x.funNullableT() + if (x != null || this.x != null) x.funNullableAny() + if (x != null || this.x != null) x + if (x != null || this.x != null) this.x.equals(null) + if (x != null || this.x != null) this.x.propT + if (x != null || this.x != null) this.x.propAny + if (x != null || this.x != null) this.x.propNullableT + if (x != null || this.x != null) this.x.propNullableAny + if (x != null || this.x != null) this.x.funT() + if (x != null || this.x != null) this.x.funAny() + if (x != null || this.x != null) this.x.funNullableT() + if (x != null || this.x != null) this.x.funNullableAny() + if (x != null || this.x != null) this.x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + if (this.y != null) this.y.equals(null) + if (this.y != null) this.y.propT + if (this.y != null) this.y.propAny + if (this.y != null) this.y.propNullableT + if (this.y != null) this.y.propNullableAny + if (this.y != null) this.y.funT() + if (this.y != null) this.y.funAny() + if (this.y != null) this.y.funNullableT() + if (this.y != null) this.y.funNullableAny() + if (this.y != null) this.y + if (this.y != null) y.equals(null) + if (this.y != null) y.propT + if (this.y != null) y.propAny + if (this.y != null) y.propNullableT + if (this.y != null) y.propNullableAny + if (this.y != null) y.funT() + if (this.y != null) y.funAny() + if (this.y != null) y.funNullableT() + if (this.y != null) y.funNullableAny() + if (this.y != null) y + if (y != null) this.y.equals(null) + if (y != null) this.y.propT + if (y != null) this.y.propAny + if (y != null) this.y.propNullableT + if (y != null) this.y.propNullableAny + if (y != null) this.y.funT() + if (y != null) this.y.funAny() + if (y != null) this.y.funNullableT() + if (y != null) this.y.funNullableAny() + if (y != null) this.y + if (y != null || this.y != null) y.equals(null) + if (y != null || this.y != null) y.propT + if (y != null || this.y != null) y.propAny + if (y != null || this.y != null) y.propNullableT + if (y != null || this.y != null) y.propNullableAny + if (y != null || this.y != null) y.funT() + if (y != null || this.y != null) y.funAny() + if (y != null || this.y != null) y.funNullableT() + if (y != null || this.y != null) y.funNullableAny() + if (y != null || this.y != null) y + if (y != null || this.y != null) this.y.equals(null) + if (y != null || this.y != null) this.y.propT + if (y != null || this.y != null) this.y.propAny + if (y != null || this.y != null) this.y.propNullableT + if (y != null || this.y != null) this.y.propNullableAny + if (y != null || this.y != null) this.y.funT() + if (y != null || this.y != null) this.y.funAny() + if (y != null || this.y != null) this.y.funNullableT() + if (y != null || this.y != null) this.y.funNullableAny() + if (y != null || this.y != null) this.y + + if (z != null) z.equals(null) + + if (z != null) z.propT + + if (z != null) z.propAny + + if (z != null) z.propNullableT + + if (z != null) z.propNullableAny + + if (z != null) z.funT() + + if (z != null) z.funAny() + + if (z != null) z.funNullableT() + + if (z != null) z.funNullableAny() + if (z != null) z + if (this.z != null) this.z.equals(null) + if (this.z != null) this.z.propT + if (this.z != null) this.z.propAny + if (this.z != null) this.z.propNullableT + if (this.z != null) this.z.propNullableAny + if (this.z != null) this.z.funT() + if (this.z != null) this.z.funAny() + if (this.z != null) this.z.funNullableT() + if (this.z != null) this.z.funNullableAny() + if (this.z != null) this.z + if (z != null) this.z.equals(null) + if (z != null) this.z.propT + if (z != null) this.z.propAny + if (z != null) this.z.propNullableT + if (z != null) this.z.propNullableAny + if (z != null) this.z.funT() + if (z != null) this.z.funAny() + if (z != null) this.z.funNullableT() + if (z != null) this.z.funNullableAny() + if (z != null) this.z + if (this.z != null) z.equals(null) + if (this.z != null) z.propT + if (this.z != null) z.propAny + if (this.z != null) z.propNullableT + if (this.z != null) z.propNullableAny + if (this.z != null) z.funT() + if (this.z != null) z.funAny() + if (this.z != null) z.funNullableT() + if (this.z != null) z.funNullableAny() + if (this.z != null) z + if (z != null || this.z != null) z.equals(null) + if (z != null || this.z != null) z.propT + if (z != null || this.z != null) z.propAny + if (z != null || this.z != null) z.propNullableT + if (z != null || this.z != null) z.propNullableAny + if (z != null || this.z != null) z.funT() + if (z != null || this.z != null) z.funAny() + if (z != null || this.z != null) z.funNullableT() + if (z != null || this.z != null) z.funNullableAny() + if (z != null || this.z != null) z + if (z != null || this.z != null) this.z.equals(null) + if (z != null || this.z != null) this.z.propT + if (z != null || this.z != null) this.z.propAny + if (z != null || this.z != null) this.z.propNullableT + if (z != null || this.z != null) this.z.propNullableAny + if (z != null || this.z != null) this.z.funT() + if (z != null || this.z != null) this.z.funAny() + if (z != null || this.z != null) this.z.funNullableT() + if (z != null || this.z != null) this.z.funNullableAny() + if (z != null || this.z != null) this.z + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + if (this.u != null) this.u.equals(null) + if (this.u != null) this.u.propT + if (this.u != null) this.u.propAny + if (this.u != null) this.u.propNullableT + if (this.u != null) this.u.propNullableAny + if (this.u != null) this.u.funT() + if (this.u != null) this.u.funAny() + if (this.u != null) this.u.funNullableT() + if (this.u != null) this.u.funNullableAny() + if (this.u != null) this.u + if (this.u != null) u.equals(null) + if (this.u != null) u.propT + if (this.u != null) u.propAny + if (this.u != null) u.propNullableT + if (this.u != null) u.propNullableAny + if (this.u != null) u.funT() + if (this.u != null) u.funAny() + if (this.u != null) u.funNullableT() + if (this.u != null) u.funNullableAny() + if (this.u != null) u + if (u != null) this.u.equals(null) + if (u != null) this.u.propT + if (u != null) this.u.propAny + if (u != null) this.u.propNullableT + if (u != null) this.u.propNullableAny + if (u != null) this.u.funT() + if (u != null) this.u.funAny() + if (u != null) this.u.funNullableT() + if (u != null) this.u.funNullableAny() + if (u != null) this.u + if (u != null || this.u != null) u.equals(null) + if (u != null || this.u != null) u.propT + if (u != null || this.u != null) u.propAny + if (u != null || this.u != null) u.propNullableT + if (u != null || this.u != null) u.propNullableAny + if (u != null || this.u != null) u.funT() + if (u != null || this.u != null) u.funAny() + if (u != null || this.u != null) u.funNullableT() + if (u != null || this.u != null) u.funNullableAny() + if (u != null || this.u != null) u + if (u != null || this.u != null) this.u.equals(null) + if (u != null || this.u != null) this.u.propT + if (u != null || this.u != null) this.u.propAny + if (u != null || this.u != null) this.u.propNullableT + if (u != null || this.u != null) this.u.propNullableAny + if (u != null || this.u != null) this.u.funT() + if (u != null || this.u != null) this.u.funAny() + if (u != null || this.u != null) this.u.funNullableT() + if (u != null || this.u != null) this.u.funNullableAny() + if (u != null || this.u != null) this.u + + v = 0 + v.equals(null) + v.propT + v.propAny + v.propNullableT + v.propNullableAny + v.funT() + v.funAny() + v.funNullableT() + v.funNullableAny() + v + if (v != null) v.equals(null) + if (v != null) v.propT + if (v != null) v.propAny + if (v != null) v.propNullableT + if (v != null) v.propNullableAny + if (v != null) v.funT() + if (v != null) v.funAny() + if (v != null) v.funNullableT() + if (v != null) v.funNullableAny() + if (v != null) v + if (this.v != null) v.equals(null) + if (this.v != null) v.propT + if (this.v != null) v.propAny + if (this.v != null) v.propNullableT + if (this.v != null) v.propNullableAny + if (this.v != null) v.funT() + if (this.v != null) v.funAny() + if (this.v != null) v.funNullableT() + if (this.v != null) v.funNullableAny() + if (this.v != null) v + if (v != null || this.v != null) v.equals(null) + if (v != null || this.v != null) v.propT + if (v != null || this.v != null) v.propAny + if (v != null || this.v != null) v.propNullableT + if (v != null || this.v != null) v.propNullableAny + if (v != null || this.v != null) v.funT() + if (v != null || this.v != null) v.funAny() + if (v != null || this.v != null) v.funNullableT() + if (v != null || this.v != null) v.funNullableAny() + if (v != null || this.v != null) v + if (v != null || this.v != null) this.v.equals(null) + if (v != null || this.v != null) this.v.propT + if (v != null || this.v != null) this.v.propAny + if (v != null || this.v != null) this.v.propNullableT + if (v != null || this.v != null) this.v.propNullableAny + if (v != null || this.v != null) this.v.funT() + if (v != null || this.v != null) this.v.funAny() + if (v != null || this.v != null) this.v.funNullableT() + if (v != null || this.v != null) this.v.funNullableAny() + if (v != null || this.v != null) this.v + + w = if (null != null) 10 else null + w + if (w != null) w.equals(null) + if (w != null) w.propT + if (w != null) w.propAny + if (w != null) w.propNullableT + if (w != null) w.propNullableAny + if (w != null) w.funT() + if (w != null) w.funAny() + if (w != null) w.funNullableT() + if (w != null) w.funNullableAny() + if (w != null) w + if (this.w != null) w.equals(null) + if (this.w != null) w.propT + if (this.w != null) w.propAny + if (this.w != null) w.propNullableT + if (this.w != null) w.propNullableAny + if (this.w != null) w.funT() + if (this.w != null) w.funAny() + if (this.w != null) w.funNullableT() + if (this.w != null) w.funNullableAny() + if (this.w != null) w + if (w != null || this.w != null) w.equals(null) + if (w != null || this.w != null) w.propT + if (w != null || this.w != null) w.propAny + if (w != null || this.w != null) w.propNullableT + if (w != null || this.w != null) w.propNullableAny + if (w != null || this.w != null) w.funT() + if (w != null || this.w != null) w.funAny() + if (w != null || this.w != null) w.funNullableT() + if (w != null || this.w != null) w.funNullableAny() + if (w != null || this.w != null) w + if (w != null || this.w != null) this.w.equals(null) + if (w != null || this.w != null) this.w.propT + if (w != null || this.w != null) this.w.propAny + if (w != null || this.w != null) this.w.propNullableT + if (w != null || this.w != null) this.w.propNullableAny + if (w != null || this.w != null) this.w.funT() + if (w != null || this.w != null) this.w.funAny() + if (w != null || this.w != null) this.w.funNullableT() + if (w != null || this.w != null) this.w.funNullableAny() + if (w != null || this.w != null) this.w + + s = null + s.hashCode() + s + if (s != null) s.java + if (s != null) s + if (this.s != null) s.java + if (this.s != null) s + if (s != null || this.s != null) s.java + if (s != null || this.s != null) s + if (s != null || this.s != null) this.s.java + if (s != null || this.s != null) this.s + } + + fun test() { + if (b != null) b.equals(null) + if (b != null) b.propT + if (b != null) b.propAny + if (b != null) b.propNullableT + if (b != null) b.propNullableAny + if (b != null) b.funT() + if (b != null) b.funAny() + if (b != null) b.funNullableT() + if (b != null) b.funNullableAny() + if (b != null) b + + if (c != null) c.equals(null) + + if (c != null) c.propT + + if (c != null) c.propAny + + if (c != null) c.propNullableT + + if (c != null) c.propNullableAny + + if (c != null) c.funT() + + if (c != null) c.funAny() + + if (c != null) c.funNullableT() + + if (c != null) c.funNullableAny() + if (c != null) c + + if (d != null) d.equals(null) + + if (d != null) d.propT + + if (d != null) d.propAny + + if (d != null) d.propNullableT + + if (d != null) d.propNullableAny + + if (d != null) d.funT() + + if (d != null) d.funAny() + + if (d != null) d.funNullableT() + + if (d != null) d.funNullableAny() + if (d != null) d + + if (e != null) e.equals(null) + + if (e != null) e.propT + + if (e != null) e.propAny + + if (e != null) e.propNullableT + + if (e != null) e.propNullableAny + + if (e != null) e.funT() + + if (e != null) e.funAny() + + if (e != null) e.funNullableT() + + if (e != null) e.funNullableAny() + if (e != null) e + + if (f != null) f.equals(null) + + if (f != null) f.propT + + if (f != null) f.propAny + + if (f != null) f.propNullableT + + if (f != null) f.propNullableAny + + if (f != null) f.funT() + + if (f != null) f.funAny() + + if (f != null) f.funNullableT() + + if (f != null) f.funNullableAny() + if (f != null) f + + if (x != null) x.equals(null) + + if (x != null) x.propT + + if (x != null) x.propAny + + if (x != null) x.propNullableT + + if (x != null) x.propNullableAny + + if (x != null) x.funT() + + if (x != null) x.funAny() + + if (x != null) x.funNullableT() + + if (x != null) x.funNullableAny() + if (x != null) x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + + if (z != null) z.equals(null) + + if (z != null) z.propT + + if (z != null) z.propAny + + if (z != null) z.propNullableT + + if (z != null) z.propNullableAny + + if (z != null) z.funT() + + if (z != null) z.funAny() + + if (z != null) z.funNullableT() + + if (z != null) z.funNullableAny() + if (z != null) z + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + + if (v != null) v.equals(null) + + if (v != null) v.propT + + if (v != null) v.propAny + + if (v != null) v.propNullableT + + if (v != null) v.propNullableAny + + if (v != null) v.funT() + + if (v != null) v.funAny() + + if (v != null) v.funNullableT() + + if (v != null) v.funNullableAny() + if (v != null) v + + if (w != null) w.equals(null) + + if (w != null) w.propT + + if (w != null) w.propAny + + if (w != null) w.propNullableT + + if (w != null) w.propNullableAny + + if (w != null) w.funT() + + if (w != null) w.funAny() + + if (w != null) w.funNullableT() + + if (w != null) w.funNullableAny() + if (w != null) w + + if (s != null) s.equals(null) + + if (s != null) s.propT + + if (s != null) s.propAny + + if (s != null) s.propNullableT + + if (s != null) s.propNullableAny + + if (s != null) s.funT() + + if (s != null) s.funAny() + + if (s != null) s.funNullableT() + + if (s != null) s.funNullableAny() + if (s != null) s + } +} + +fun case_30(a: Case30) { + if (a.x !== null) a.x.equals(null) + if (a.x !== null) a.x.propT + if (a.x !== null) a.x.propAny + if (a.x !== null) a.x.propNullableT + if (a.x !== null) a.x.propNullableAny + if (a.x !== null) a.x.funT() + if (a.x !== null) a.x.funAny() + if (a.x !== null) a.x.funNullableT() + if (a.x !== null) a.x.funNullableAny() + if (a.x !== null) a.x + if (a.b !== null) a.b.equals(null) + if (a.b !== null) a.b.propT + if (a.b !== null) a.b.propAny + if (a.b !== null) a.b.propNullableT + if (a.b !== null) a.b.propNullableAny + if (a.b !== null) a.b.funT() + if (a.b !== null) a.b.funAny() + if (a.b !== null) a.b.funNullableT() + if (a.b !== null) a.b.funNullableAny() + if (a.b !== null) a.b + if (a.e !== null) a.e.equals(null) + if (a.e !== null) a.e.propT + if (a.e !== null) a.e.propAny + if (a.e !== null) a.e.propNullableT + if (a.e !== null) a.e.propNullableAny + if (a.e !== null) a.e.funT() + if (a.e !== null) a.e.funAny() + if (a.e !== null) a.e.funNullableT() + if (a.e !== null) a.e.funNullableAny() + if (a.e !== null) a.e + if (a.f !== null) a.f.equals(null) + if (a.f !== null) a.f.propT + if (a.f !== null) a.f.propAny + if (a.f !== null) a.f.propNullableT + if (a.f !== null) a.f.propNullableAny + if (a.f !== null) a.f.funT() + if (a.f !== null) a.f.funAny() + if (a.f !== null) a.f.funNullableT() + if (a.f !== null) a.f.funNullableAny() + if (a.f !== null) a.f + if (a.v != null) a.v.equals(null) + if (a.v != null) a.v.propT + if (a.v != null) a.v.propAny + if (a.v != null) a.v.propNullableT + if (a.v != null) a.v.propNullableAny + if (a.v != null) a.v.funT() + if (a.v != null) a.v.funAny() + if (a.v != null) a.v.funNullableT() + if (a.v != null) a.v.funNullableAny() + if (a.v != null) a.v + if (a.w != null) a.w.equals(null) + if (a.w != null) a.w.propT + if (a.w != null) a.w.propAny + if (a.w != null) a.w.propNullableT + if (a.w != null) a.w.propNullableAny + if (a.w != null) a.w.funT() + if (a.w != null) a.w.funAny() + if (a.w != null) a.w.funNullableT() + if (a.w != null) a.w.funNullableAny() + if (a.w != null) a.w + if (a.s != null) a.s.equals(null) + if (a.s != null) a.s.propT + if (a.s != null) a.s.propAny + if (a.s != null) a.s.propNullableT + if (a.s != null) a.s.propNullableAny + if (a.s != null) a.s.funT() + if (a.s != null) a.s.funAny() + if (a.s != null) a.s.funNullableT() + if (a.s != null) a.s.funNullableAny() + if (a.s != null) a.s +} + +// TESTCASE NUMBER: 31 +enum class Case31(a: Int?, val b: Float?, private val c: Unit?, protected val d: String?, internal val e: Char?, public val f: Any?) { + A(1, 2f, kotlin.Unit, "", ',', null), B(1, 2f, kotlin.Unit, "", ',', null), C(1, 2f, kotlin.Unit, "", ',', null); + + val x: Char? = '.' + private val y: Unit? = kotlin.Unit + protected val z: Int? = 12 + public val u: String? = "..." + val s: Any? + val v: Int? + val w: Number? + val t: String? = if (u != null) this.u else null + + init { + if (a != null) a.equals(null) + if (a != null) a.propT + if (a != null) a.propAny + if (a != null) a.propNullableT + if (a != null) a.propNullableAny + if (a != null) a.funT() + if (a != null) a.funAny() + if (a != null) a.funNullableT() + if (a != null) a.funNullableAny() + if (a != null) a + + if (b != null) b.equals(null) + + if (b != null) b.propT + + if (b != null) b.propAny + + if (b != null) b.propNullableT + + if (b != null) b.propNullableAny + + if (b != null) b.funT() + + if (b != null) b.funAny() + + if (b != null) b.funNullableT() + + if (b != null) b.funNullableAny() + if (b != null) b + if (this.b != null) this.b.equals(null) + if (this.b != null) this.b.propT + if (this.b != null) this.b.propAny + if (this.b != null) this.b.propNullableT + if (this.b != null) this.b.propNullableAny + if (this.b != null) this.b.funT() + if (this.b != null) this.b.funAny() + if (this.b != null) this.b.funNullableT() + if (this.b != null) this.b.funNullableAny() + if (this.b != null) this.b + if (this.b != null) b.equals(null) + if (this.b != null) b.propT + if (this.b != null) b.propAny + if (this.b != null) b.propNullableT + if (this.b != null) b.propNullableAny + if (this.b != null) b.funT() + if (this.b != null) b.funAny() + if (this.b != null) b.funNullableT() + if (this.b != null) b.funNullableAny() + if (this.b != null) b + if (b != null) this.b.equals(null) + if (b != null) this.b.propT + if (b != null) this.b.propAny + if (b != null) this.b.propNullableT + if (b != null) this.b.propNullableAny + if (b != null) this.b.funT() + if (b != null) this.b.funAny() + if (b != null) this.b.funNullableT() + if (b != null) this.b.funNullableAny() + if (b != null) this.b + if (b != null || this.b != null) b.equals(null) + if (b != null || this.b != null) b.propT + if (b != null || this.b != null) b.propAny + if (b != null || this.b != null) b.propNullableT + if (b != null || this.b != null) b.propNullableAny + if (b != null || this.b != null) b.funT() + if (b != null || this.b != null) b.funAny() + if (b != null || this.b != null) b.funNullableT() + if (b != null || this.b != null) b.funNullableAny() + if (b != null || this.b != null) b + if (b != null || this.b != null) this.b.equals(null) + if (b != null || this.b != null) this.b.propT + if (b != null || this.b != null) this.b.propAny + if (b != null || this.b != null) this.b.propNullableT + if (b != null || this.b != null) this.b.propNullableAny + if (b != null || this.b != null) this.b.funT() + if (b != null || this.b != null) this.b.funAny() + if (b != null || this.b != null) this.b.funNullableT() + if (b != null || this.b != null) this.b.funNullableAny() + if (b != null || this.b != null) this.b + + if (c != null) c.equals(null) + + if (c != null) c.propT + + if (c != null) c.propAny + + if (c != null) c.propNullableT + + if (c != null) c.propNullableAny + + if (c != null) c.funT() + + if (c != null) c.funAny() + + if (c != null) c.funNullableT() + + if (c != null) c.funNullableAny() + if (c != null) c + if (this.c != null) this.c.equals(null) + if (this.c != null) this.c.propT + if (this.c != null) this.c.propAny + if (this.c != null) this.c.propNullableT + if (this.c != null) this.c.propNullableAny + if (this.c != null) this.c.funT() + if (this.c != null) this.c.funAny() + if (this.c != null) this.c.funNullableT() + if (this.c != null) this.c.funNullableAny() + if (this.c != null) this.c + if (c != null) this.c.equals(null) + if (c != null) this.c.propT + if (c != null) this.c.propAny + if (c != null) this.c.propNullableT + if (c != null) this.c.propNullableAny + if (c != null) this.c.funT() + if (c != null) this.c.funAny() + if (c != null) this.c.funNullableT() + if (c != null) this.c.funNullableAny() + if (c != null) this.c + if (this.c != null) c.equals(null) + if (this.c != null) c.propT + if (this.c != null) c.propAny + if (this.c != null) c.propNullableT + if (this.c != null) c.propNullableAny + if (this.c != null) c.funT() + if (this.c != null) c.funAny() + if (this.c != null) c.funNullableT() + if (this.c != null) c.funNullableAny() + if (this.c != null) c + if (c != null || this.c != null) c.equals(null) + if (c != null || this.c != null) c.propT + if (c != null || this.c != null) c.propAny + if (c != null || this.c != null) c.propNullableT + if (c != null || this.c != null) c.propNullableAny + if (c != null || this.c != null) c.funT() + if (c != null || this.c != null) c.funAny() + if (c != null || this.c != null) c.funNullableT() + if (c != null || this.c != null) c.funNullableAny() + if (c != null || this.c != null) c + if (c != null || this.c != null) this.c.equals(null) + if (c != null || this.c != null) this.c.propT + if (c != null || this.c != null) this.c.propAny + if (c != null || this.c != null) this.c.propNullableT + if (c != null || this.c != null) this.c.propNullableAny + if (c != null || this.c != null) this.c.funT() + if (c != null || this.c != null) this.c.funAny() + if (c != null || this.c != null) this.c.funNullableT() + if (c != null || this.c != null) this.c.funNullableAny() + if (c != null || this.c != null) this.c + + if (d != null) d.equals(null) + + if (d != null) d.propT + + if (d != null) d.propAny + + if (d != null) d.propNullableT + + if (d != null) d.propNullableAny + + if (d != null) d.funT() + + if (d != null) d.funAny() + + if (d != null) d.funNullableT() + + if (d != null) d.funNullableAny() + if (d != null) d + if (this.d != null) this.d.equals(null) + if (this.d != null) this.d.propT + if (this.d != null) this.d.propAny + if (this.d != null) this.d.propNullableT + if (this.d != null) this.d.propNullableAny + if (this.d != null) this.d.funT() + if (this.d != null) this.d.funAny() + if (this.d != null) this.d.funNullableT() + if (this.d != null) this.d.funNullableAny() + if (this.d != null) this.d + if (d != null) this.d.equals(null) + if (d != null) this.d.propT + if (d != null) this.d.propAny + if (d != null) this.d.propNullableT + if (d != null) this.d.propNullableAny + if (d != null) this.d.funT() + if (d != null) this.d.funAny() + if (d != null) this.d.funNullableT() + if (d != null) this.d.funNullableAny() + if (d != null) this.d + if (this.d != null) d.equals(null) + if (this.d != null) d.propT + if (this.d != null) d.propAny + if (this.d != null) d.propNullableT + if (this.d != null) d.propNullableAny + if (this.d != null) d.funT() + if (this.d != null) d.funAny() + if (this.d != null) d.funNullableT() + if (this.d != null) d.funNullableAny() + if (this.d != null) d + if (d != null || this.d != null) d.equals(null) + if (d != null || this.d != null) d.propT + if (d != null || this.d != null) d.propAny + if (d != null || this.d != null) d.propNullableT + if (d != null || this.d != null) d.propNullableAny + if (d != null || this.d != null) d.funT() + if (d != null || this.d != null) d.funAny() + if (d != null || this.d != null) d.funNullableT() + if (d != null || this.d != null) d.funNullableAny() + if (d != null || this.d != null) d + if (d != null || this.d != null) this.d.equals(null) + if (d != null || this.d != null) this.d.propT + if (d != null || this.d != null) this.d.propAny + if (d != null || this.d != null) this.d.propNullableT + if (d != null || this.d != null) this.d.propNullableAny + if (d != null || this.d != null) this.d.funT() + if (d != null || this.d != null) this.d.funAny() + if (d != null || this.d != null) this.d.funNullableT() + if (d != null || this.d != null) this.d.funNullableAny() + if (d != null || this.d != null) this.d + + if (e != null) e.equals(null) + + if (e != null) e.propT + + if (e != null) e.propAny + + if (e != null) e.propNullableT + + if (e != null) e.propNullableAny + + if (e != null) e.funT() + + if (e != null) e.funAny() + + if (e != null) e.funNullableT() + + if (e != null) e.funNullableAny() + if (e != null) e + if (this.e != null) this.e.equals(null) + if (this.e != null) this.e.propT + if (this.e != null) this.e.propAny + if (this.e != null) this.e.propNullableT + if (this.e != null) this.e.propNullableAny + if (this.e != null) this.e.funT() + if (this.e != null) this.e.funAny() + if (this.e != null) this.e.funNullableT() + if (this.e != null) this.e.funNullableAny() + if (this.e != null) this.e + if (this.e != null) e.equals(null) + if (this.e != null) e.propT + if (this.e != null) e.propAny + if (this.e != null) e.propNullableT + if (this.e != null) e.propNullableAny + if (this.e != null) e.funT() + if (this.e != null) e.funAny() + if (this.e != null) e.funNullableT() + if (this.e != null) e.funNullableAny() + if (this.e != null) e + if (e != null) this.e.equals(null) + if (e != null) this.e.propT + if (e != null) this.e.propAny + if (e != null) this.e.propNullableT + if (e != null) this.e.propNullableAny + if (e != null) this.e.funT() + if (e != null) this.e.funAny() + if (e != null) this.e.funNullableT() + if (e != null) this.e.funNullableAny() + if (e != null) this.e + if (e != null || this.e != null) e.equals(null) + if (e != null || this.e != null) e.propT + if (e != null || this.e != null) e.propAny + if (e != null || this.e != null) e.propNullableT + if (e != null || this.e != null) e.propNullableAny + if (e != null || this.e != null) e.funT() + if (e != null || this.e != null) e.funAny() + if (e != null || this.e != null) e.funNullableT() + if (e != null || this.e != null) e.funNullableAny() + if (e != null || this.e != null) e + if (e != null || this.e != null) this.e.equals(null) + if (e != null || this.e != null) this.e.propT + if (e != null || this.e != null) this.e.propAny + if (e != null || this.e != null) this.e.propNullableT + if (e != null || this.e != null) this.e.propNullableAny + if (e != null || this.e != null) this.e.funT() + if (e != null || this.e != null) this.e.funAny() + if (e != null || this.e != null) this.e.funNullableT() + if (e != null || this.e != null) this.e.funNullableAny() + if (e != null || this.e != null) this.e + + if (f != null) f.equals(null) + + if (f != null) f.propT + + if (f != null) f.propAny + + if (f != null) f.propNullableT + + if (f != null) f.propNullableAny + + if (f != null) f.funT() + + if (f != null) f.funAny() + + if (f != null) f.funNullableT() + + if (f != null) f.funNullableAny() + if (f != null) f + if (this.f != null) this.f.equals(null) + if (this.f != null) this.f.propT + if (this.f != null) this.f.propAny + if (this.f != null) this.f.propNullableT + if (this.f != null) this.f.propNullableAny + if (this.f != null) this.f.funT() + if (this.f != null) this.f.funAny() + if (this.f != null) this.f.funNullableT() + if (this.f != null) this.f.funNullableAny() + if (this.f != null) this.f + if (this.f != null) f.equals(null) + if (this.f != null) f.propT + if (this.f != null) f.propAny + if (this.f != null) f.propNullableT + if (this.f != null) f.propNullableAny + if (this.f != null) f.funT() + if (this.f != null) f.funAny() + if (this.f != null) f.funNullableT() + if (this.f != null) f.funNullableAny() + if (this.f != null) f + if (f != null) this.f.equals(null) + if (f != null) this.f.propT + if (f != null) this.f.propAny + if (f != null) this.f.propNullableT + if (f != null) this.f.propNullableAny + if (f != null) this.f.funT() + if (f != null) this.f.funAny() + if (f != null) this.f.funNullableT() + if (f != null) this.f.funNullableAny() + if (f != null) this.f + if (f != null || this.f != null) f.equals(null) + if (f != null || this.f != null) f.propT + if (f != null || this.f != null) f.propAny + if (f != null || this.f != null) f.propNullableT + if (f != null || this.f != null) f.propNullableAny + if (f != null || this.f != null) f.funT() + if (f != null || this.f != null) f.funAny() + if (f != null || this.f != null) f.funNullableT() + if (f != null || this.f != null) f.funNullableAny() + if (f != null || this.f != null) f + if (f != null || this.f != null) this.f.equals(null) + if (f != null || this.f != null) this.f.propT + if (f != null || this.f != null) this.f.propAny + if (f != null || this.f != null) this.f.propNullableT + if (f != null || this.f != null) this.f.propNullableAny + if (f != null || this.f != null) this.f.funT() + if (f != null || this.f != null) this.f.funAny() + if (f != null || this.f != null) this.f.funNullableT() + if (f != null || this.f != null) this.f.funNullableAny() + if (f != null || this.f != null) this.f + + if (x != null) x.equals(null) + + if (x != null) x.propT + + if (x != null) x.propAny + + if (x != null) x.propNullableT + + if (x != null) x.propNullableAny + + if (x != null) x.funT() + + if (x != null) x.funAny() + + if (x != null) x.funNullableT() + + if (x != null) x.funNullableAny() + if (x != null) x + if (this.x != null) this.x.equals(null) + if (this.x != null) this.x.propT + if (this.x != null) this.x.propAny + if (this.x != null) this.x.propNullableT + if (this.x != null) this.x.propNullableAny + if (this.x != null) this.x.funT() + if (this.x != null) this.x.funAny() + if (this.x != null) this.x.funNullableT() + if (this.x != null) this.x.funNullableAny() + if (this.x != null) this.x + if (x != null) this.x.equals(null) + if (x != null) this.x.propT + if (x != null) this.x.propAny + if (x != null) this.x.propNullableT + if (x != null) this.x.propNullableAny + if (x != null) this.x.funT() + if (x != null) this.x.funAny() + if (x != null) this.x.funNullableT() + if (x != null) this.x.funNullableAny() + if (x != null) this.x + if (this.x != null) x.equals(null) + if (this.x != null) x.propT + if (this.x != null) x.propAny + if (this.x != null) x.propNullableT + if (this.x != null) x.propNullableAny + if (this.x != null) x.funT() + if (this.x != null) x.funAny() + if (this.x != null) x.funNullableT() + if (this.x != null) x.funNullableAny() + if (this.x != null) x + if (x != null || this.x != null) x.equals(null) + if (x != null || this.x != null) x.propT + if (x != null || this.x != null) x.propAny + if (x != null || this.x != null) x.propNullableT + if (x != null || this.x != null) x.propNullableAny + if (x != null || this.x != null) x.funT() + if (x != null || this.x != null) x.funAny() + if (x != null || this.x != null) x.funNullableT() + if (x != null || this.x != null) x.funNullableAny() + if (x != null || this.x != null) x + if (x != null || this.x != null) this.x.equals(null) + if (x != null || this.x != null) this.x.propT + if (x != null || this.x != null) this.x.propAny + if (x != null || this.x != null) this.x.propNullableT + if (x != null || this.x != null) this.x.propNullableAny + if (x != null || this.x != null) this.x.funT() + if (x != null || this.x != null) this.x.funAny() + if (x != null || this.x != null) this.x.funNullableT() + if (x != null || this.x != null) this.x.funNullableAny() + if (x != null || this.x != null) this.x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + if (this.y != null) this.y.equals(null) + if (this.y != null) this.y.propT + if (this.y != null) this.y.propAny + if (this.y != null) this.y.propNullableT + if (this.y != null) this.y.propNullableAny + if (this.y != null) this.y.funT() + if (this.y != null) this.y.funAny() + if (this.y != null) this.y.funNullableT() + if (this.y != null) this.y.funNullableAny() + if (this.y != null) this.y + if (this.y != null) y.equals(null) + if (this.y != null) y.propT + if (this.y != null) y.propAny + if (this.y != null) y.propNullableT + if (this.y != null) y.propNullableAny + if (this.y != null) y.funT() + if (this.y != null) y.funAny() + if (this.y != null) y.funNullableT() + if (this.y != null) y.funNullableAny() + if (this.y != null) y + if (y != null) this.y.equals(null) + if (y != null) this.y.propT + if (y != null) this.y.propAny + if (y != null) this.y.propNullableT + if (y != null) this.y.propNullableAny + if (y != null) this.y.funT() + if (y != null) this.y.funAny() + if (y != null) this.y.funNullableT() + if (y != null) this.y.funNullableAny() + if (y != null) this.y + if (y != null || this.y != null) y.equals(null) + if (y != null || this.y != null) y.propT + if (y != null || this.y != null) y.propAny + if (y != null || this.y != null) y.propNullableT + if (y != null || this.y != null) y.propNullableAny + if (y != null || this.y != null) y.funT() + if (y != null || this.y != null) y.funAny() + if (y != null || this.y != null) y.funNullableT() + if (y != null || this.y != null) y.funNullableAny() + if (y != null || this.y != null) y + if (y != null || this.y != null) this.y.equals(null) + if (y != null || this.y != null) this.y.propT + if (y != null || this.y != null) this.y.propAny + if (y != null || this.y != null) this.y.propNullableT + if (y != null || this.y != null) this.y.propNullableAny + if (y != null || this.y != null) this.y.funT() + if (y != null || this.y != null) this.y.funAny() + if (y != null || this.y != null) this.y.funNullableT() + if (y != null || this.y != null) this.y.funNullableAny() + if (y != null || this.y != null) this.y + + if (z != null) z.equals(null) + + if (z != null) z.propT + + if (z != null) z.propAny + + if (z != null) z.propNullableT + + if (z != null) z.propNullableAny + + if (z != null) z.funT() + + if (z != null) z.funAny() + + if (z != null) z.funNullableT() + + if (z != null) z.funNullableAny() + if (z != null) z + if (this.z != null) this.z.equals(null) + if (this.z != null) this.z.propT + if (this.z != null) this.z.propAny + if (this.z != null) this.z.propNullableT + if (this.z != null) this.z.propNullableAny + if (this.z != null) this.z.funT() + if (this.z != null) this.z.funAny() + if (this.z != null) this.z.funNullableT() + if (this.z != null) this.z.funNullableAny() + if (this.z != null) this.z + if (z != null) this.z.equals(null) + if (z != null) this.z.propT + if (z != null) this.z.propAny + if (z != null) this.z.propNullableT + if (z != null) this.z.propNullableAny + if (z != null) this.z.funT() + if (z != null) this.z.funAny() + if (z != null) this.z.funNullableT() + if (z != null) this.z.funNullableAny() + if (z != null) this.z + if (this.z != null) z.equals(null) + if (this.z != null) z.propT + if (this.z != null) z.propAny + if (this.z != null) z.propNullableT + if (this.z != null) z.propNullableAny + if (this.z != null) z.funT() + if (this.z != null) z.funAny() + if (this.z != null) z.funNullableT() + if (this.z != null) z.funNullableAny() + if (this.z != null) z + if (z != null || this.z != null) z.equals(null) + if (z != null || this.z != null) z.propT + if (z != null || this.z != null) z.propAny + if (z != null || this.z != null) z.propNullableT + if (z != null || this.z != null) z.propNullableAny + if (z != null || this.z != null) z.funT() + if (z != null || this.z != null) z.funAny() + if (z != null || this.z != null) z.funNullableT() + if (z != null || this.z != null) z.funNullableAny() + if (z != null || this.z != null) z + if (z != null || this.z != null) this.z.equals(null) + if (z != null || this.z != null) this.z.propT + if (z != null || this.z != null) this.z.propAny + if (z != null || this.z != null) this.z.propNullableT + if (z != null || this.z != null) this.z.propNullableAny + if (z != null || this.z != null) this.z.funT() + if (z != null || this.z != null) this.z.funAny() + if (z != null || this.z != null) this.z.funNullableT() + if (z != null || this.z != null) this.z.funNullableAny() + if (z != null || this.z != null) this.z + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + if (this.u != null) this.u.equals(null) + if (this.u != null) this.u.propT + if (this.u != null) this.u.propAny + if (this.u != null) this.u.propNullableT + if (this.u != null) this.u.propNullableAny + if (this.u != null) this.u.funT() + if (this.u != null) this.u.funAny() + if (this.u != null) this.u.funNullableT() + if (this.u != null) this.u.funNullableAny() + if (this.u != null) this.u + if (this.u != null) u.equals(null) + if (this.u != null) u.propT + if (this.u != null) u.propAny + if (this.u != null) u.propNullableT + if (this.u != null) u.propNullableAny + if (this.u != null) u.funT() + if (this.u != null) u.funAny() + if (this.u != null) u.funNullableT() + if (this.u != null) u.funNullableAny() + if (this.u != null) u + if (u != null) this.u.equals(null) + if (u != null) this.u.propT + if (u != null) this.u.propAny + if (u != null) this.u.propNullableT + if (u != null) this.u.propNullableAny + if (u != null) this.u.funT() + if (u != null) this.u.funAny() + if (u != null) this.u.funNullableT() + if (u != null) this.u.funNullableAny() + if (u != null) this.u + if (u != null || this.u != null) u.equals(null) + if (u != null || this.u != null) u.propT + if (u != null || this.u != null) u.propAny + if (u != null || this.u != null) u.propNullableT + if (u != null || this.u != null) u.propNullableAny + if (u != null || this.u != null) u.funT() + if (u != null || this.u != null) u.funAny() + if (u != null || this.u != null) u.funNullableT() + if (u != null || this.u != null) u.funNullableAny() + if (u != null || this.u != null) u + if (u != null || this.u != null) this.u.equals(null) + if (u != null || this.u != null) this.u.propT + if (u != null || this.u != null) this.u.propAny + if (u != null || this.u != null) this.u.propNullableT + if (u != null || this.u != null) this.u.propNullableAny + if (u != null || this.u != null) this.u.funT() + if (u != null || this.u != null) this.u.funAny() + if (u != null || this.u != null) this.u.funNullableT() + if (u != null || this.u != null) this.u.funNullableAny() + if (u != null || this.u != null) this.u + + v = 0 + v.equals(null) + v.propT + v.propAny + v.propNullableT + v.propNullableAny + v.funT() + v.funAny() + v.funNullableT() + v.funNullableAny() + v + if (v != null) v.equals(null) + if (v != null) v.propT + if (v != null) v.propAny + if (v != null) v.propNullableT + if (v != null) v.propNullableAny + if (v != null) v.funT() + if (v != null) v.funAny() + if (v != null) v.funNullableT() + if (v != null) v.funNullableAny() + if (v != null) v + if (this.v != null) v.equals(null) + if (this.v != null) v.propT + if (this.v != null) v.propAny + if (this.v != null) v.propNullableT + if (this.v != null) v.propNullableAny + if (this.v != null) v.funT() + if (this.v != null) v.funAny() + if (this.v != null) v.funNullableT() + if (this.v != null) v.funNullableAny() + if (this.v != null) v + if (v != null || this.v != null) v.equals(null) + if (v != null || this.v != null) v.propT + if (v != null || this.v != null) v.propAny + if (v != null || this.v != null) v.propNullableT + if (v != null || this.v != null) v.propNullableAny + if (v != null || this.v != null) v.funT() + if (v != null || this.v != null) v.funAny() + if (v != null || this.v != null) v.funNullableT() + if (v != null || this.v != null) v.funNullableAny() + if (v != null || this.v != null) v + if (v != null || this.v != null) this.v.equals(null) + if (v != null || this.v != null) this.v.propT + if (v != null || this.v != null) this.v.propAny + if (v != null || this.v != null) this.v.propNullableT + if (v != null || this.v != null) this.v.propNullableAny + if (v != null || this.v != null) this.v.funT() + if (v != null || this.v != null) this.v.funAny() + if (v != null || this.v != null) this.v.funNullableT() + if (v != null || this.v != null) this.v.funNullableAny() + if (v != null || this.v != null) this.v + + w = if (null != null) 10 else null + if (w != null) w.equals(null) + if (w != null) w.propT + if (w != null) w.propAny + if (w != null) w.propNullableT + if (w != null) w.propNullableAny + if (w != null) w.funT() + if (w != null) w.funAny() + if (w != null) w.funNullableT() + if (w != null) w.funNullableAny() + if (w != null) w + if (this.w != null) w.equals(null) + if (this.w != null) w.propT + if (this.w != null) w.propAny + if (this.w != null) w.propNullableT + if (this.w != null) w.propNullableAny + if (this.w != null) w.funT() + if (this.w != null) w.funAny() + if (this.w != null) w.funNullableT() + if (this.w != null) w.funNullableAny() + if (this.w != null) w + if (w != null || this.w != null) w.equals(null) + if (w != null || this.w != null) w.propT + if (w != null || this.w != null) w.propAny + if (w != null || this.w != null) w.propNullableT + if (w != null || this.w != null) w.propNullableAny + if (w != null || this.w != null) w.funT() + if (w != null || this.w != null) w.funAny() + if (w != null || this.w != null) w.funNullableT() + if (w != null || this.w != null) w.funNullableAny() + if (w != null || this.w != null) w + if (w != null || this.w != null) this.w.equals(null) + if (w != null || this.w != null) this.w.propT + if (w != null || this.w != null) this.w.propAny + if (w != null || this.w != null) this.w.propNullableT + if (w != null || this.w != null) this.w.propNullableAny + if (w != null || this.w != null) this.w.funT() + if (w != null || this.w != null) this.w.funAny() + if (w != null || this.w != null) this.w.funNullableT() + if (w != null || this.w != null) this.w.funNullableAny() + if (w != null || this.w != null) this.w + + s = null + s.hashCode() + s + if (s != null) s.java + if (s != null) s + if (this.s != null) s.java + if (this.s != null) s + if (s != null || this.s != null) s.java + if (s != null || this.s != null) s + if (s != null || this.s != null) this.s.java + if (s != null || this.s != null) this.s + } + + fun test() { + if (b != null) b.equals(null) + if (b != null) b.propT + if (b != null) b.propAny + if (b != null) b.propNullableT + if (b != null) b.propNullableAny + if (b != null) b.funT() + if (b != null) b.funAny() + if (b != null) b.funNullableT() + if (b != null) b.funNullableAny() + if (b != null) b + + if (c != null) c.equals(null) + + if (c != null) c.propT + + if (c != null) c.propAny + + if (c != null) c.propNullableT + + if (c != null) c.propNullableAny + + if (c != null) c.funT() + + if (c != null) c.funAny() + + if (c != null) c.funNullableT() + + if (c != null) c.funNullableAny() + if (c != null) c + + if (d != null) d.equals(null) + + if (d != null) d.propT + + if (d != null) d.propAny + + if (d != null) d.propNullableT + + if (d != null) d.propNullableAny + + if (d != null) d.funT() + + if (d != null) d.funAny() + + if (d != null) d.funNullableT() + + if (d != null) d.funNullableAny() + if (d != null) d + + if (e != null) e.equals(null) + + if (e != null) e.propT + + if (e != null) e.propAny + + if (e != null) e.propNullableT + + if (e != null) e.propNullableAny + + if (e != null) e.funT() + + if (e != null) e.funAny() + + if (e != null) e.funNullableT() + + if (e != null) e.funNullableAny() + if (e != null) e + + if (f != null) f.equals(null) + + if (f != null) f.propT + + if (f != null) f.propAny + + if (f != null) f.propNullableT + + if (f != null) f.propNullableAny + + if (f != null) f.funT() + + if (f != null) f.funAny() + + if (f != null) f.funNullableT() + + if (f != null) f.funNullableAny() + if (f != null) f + + if (x != null) x.equals(null) + + if (x != null) x.propT + + if (x != null) x.propAny + + if (x != null) x.propNullableT + + if (x != null) x.propNullableAny + + if (x != null) x.funT() + + if (x != null) x.funAny() + + if (x != null) x.funNullableT() + + if (x != null) x.funNullableAny() + if (x != null) x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + + if (z != null) z.equals(null) + + if (z != null) z.propT + + if (z != null) z.propAny + + if (z != null) z.propNullableT + + if (z != null) z.propNullableAny + + if (z != null) z.funT() + + if (z != null) z.funAny() + + if (z != null) z.funNullableT() + + if (z != null) z.funNullableAny() + if (z != null) z + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + + if (v != null) v.equals(null) + + if (v != null) v.propT + + if (v != null) v.propAny + + if (v != null) v.propNullableT + + if (v != null) v.propNullableAny + + if (v != null) v.funT() + + if (v != null) v.funAny() + + if (v != null) v.funNullableT() + + if (v != null) v.funNullableAny() + if (v != null) v + + if (w != null) w.equals(null) + + if (w != null) w.propT + + if (w != null) w.propAny + + if (w != null) w.propNullableT + + if (w != null) w.propNullableAny + + if (w != null) w.funT() + + if (w != null) w.funAny() + + if (w != null) w.funNullableT() + + if (w != null) w.funNullableAny() + if (w != null) w + + if (s != null) s.equals(null) + + if (s != null) s.propT + + if (s != null) s.propAny + + if (s != null) s.propNullableT + + if (s != null) s.propNullableAny + + if (s != null) s.funT() + + if (s != null) s.funAny() + + if (s != null) s.funNullableT() + + if (s != null) s.funNullableAny() + if (s != null) s + } +} + +fun case_31(a: Case31) { + if (a.x !== null) a.x.equals(null) + if (a.x !== null) a.x.propT + if (a.x !== null) a.x.propAny + if (a.x !== null) a.x.propNullableT + if (a.x !== null) a.x.propNullableAny + if (a.x !== null) a.x.funT() + if (a.x !== null) a.x.funAny() + if (a.x !== null) a.x.funNullableT() + if (a.x !== null) a.x.funNullableAny() + if (a.x !== null) a.x + if (a.b !== null) a.b.equals(null) + if (a.b !== null) a.b.propT + if (a.b !== null) a.b.propAny + if (a.b !== null) a.b.propNullableT + if (a.b !== null) a.b.propNullableAny + if (a.b !== null) a.b.funT() + if (a.b !== null) a.b.funAny() + if (a.b !== null) a.b.funNullableT() + if (a.b !== null) a.b.funNullableAny() + if (a.b !== null) a.b + if (a.e !== null) a.e.equals(null) + if (a.e !== null) a.e.propT + if (a.e !== null) a.e.propAny + if (a.e !== null) a.e.propNullableT + if (a.e !== null) a.e.propNullableAny + if (a.e !== null) a.e.funT() + if (a.e !== null) a.e.funAny() + if (a.e !== null) a.e.funNullableT() + if (a.e !== null) a.e.funNullableAny() + if (a.e !== null) a.e + if (a.f !== null) a.f.equals(null) + if (a.f !== null) a.f.propT + if (a.f !== null) a.f.propAny + if (a.f !== null) a.f.propNullableT + if (a.f !== null) a.f.propNullableAny + if (a.f !== null) a.f.funT() + if (a.f !== null) a.f.funAny() + if (a.f !== null) a.f.funNullableT() + if (a.f !== null) a.f.funNullableAny() + if (a.f !== null) a.f + if (a.v != null) a.v.equals(null) + if (a.v != null) a.v.propT + if (a.v != null) a.v.propAny + if (a.v != null) a.v.propNullableT + if (a.v != null) a.v.propNullableAny + if (a.v != null) a.v.funT() + if (a.v != null) a.v.funAny() + if (a.v != null) a.v.funNullableT() + if (a.v != null) a.v.funNullableAny() + if (a.v != null) a.v + if (a.w != null) a.w.equals(null) + if (a.w != null) a.w.propT + if (a.w != null) a.w.propAny + if (a.w != null) a.w.propNullableT + if (a.w != null) a.w.propNullableAny + if (a.w != null) a.w.funT() + if (a.w != null) a.w.funAny() + if (a.w != null) a.w.funNullableT() + if (a.w != null) a.w.funNullableAny() + if (a.w != null) a.w + if (a.s != null) a.s.equals(null) + if (a.s != null) a.s.propT + if (a.s != null) a.s.propAny + if (a.s != null) a.s.propNullableT + if (a.s != null) a.s.propNullableAny + if (a.s != null) a.s.funT() + if (a.s != null) a.s.funAny() + if (a.s != null) a.s.funNullableT() + if (a.s != null) a.s.funNullableAny() + if (a.s != null) a.s + + if (Case31.A.b != null) Case31.A.b.equals(null) + + if (Case31.A.b != null) Case31.A.b.propT + + if (Case31.A.b != null) Case31.A.b.propAny + + if (Case31.A.b != null) Case31.A.b.propNullableT + + if (Case31.A.b != null) Case31.A.b.propNullableAny + + if (Case31.A.b != null) Case31.A.b.funT() + + if (Case31.A.b != null) Case31.A.b.funAny() + + if (Case31.A.b != null) Case31.A.b.funNullableT() + + if (Case31.A.b != null) Case31.A.b.funNullableAny() + if (Case31.A.b != null) Case31.A.b + if (Case31.A.e != null) Case31.A.e.equals(null) + if (Case31.A.e != null) Case31.A.e.propT + if (Case31.A.e != null) Case31.A.e.propAny + if (Case31.A.e != null) Case31.A.e.propNullableT + if (Case31.A.e != null) Case31.A.e.propNullableAny + if (Case31.A.e != null) Case31.A.e.funT() + if (Case31.A.e != null) Case31.A.e.funAny() + if (Case31.A.e != null) Case31.A.e.funNullableT() + if (Case31.A.e != null) Case31.A.e.funNullableAny() + if (Case31.A.e != null) Case31.A.e + if (Case31.A.f != null) Case31.A.f.equals(null) + if (Case31.A.f != null) Case31.A.f.propT + if (Case31.A.f != null) Case31.A.f.propAny + if (Case31.A.f != null) Case31.A.f.propNullableT + if (Case31.A.f != null) Case31.A.f.propNullableAny + if (Case31.A.f != null) Case31.A.f.funT() + if (Case31.A.f != null) Case31.A.f.funAny() + if (Case31.A.f != null) Case31.A.f.funNullableT() + if (Case31.A.f != null) Case31.A.f.funNullableAny() + if (Case31.A.f != null) Case31.A.f +} + +// TESTCASE NUMBER: 32 +object Case32 { + val x: Char? = '.' + private val y: Unit? = kotlin.Unit + public val u: String? = "..." + val s: Any? + val v: Int? + val w: Number? + val t: String? = if (u != null) this.u else null + + init { + if (x != null) x.equals(null) + if (x != null) x.propT + if (x != null) x.propAny + if (x != null) x.propNullableT + if (x != null) x.propNullableAny + if (x != null) x.funT() + if (x != null) x.funAny() + if (x != null) x.funNullableT() + if (x != null) x.funNullableAny() + if (x != null) x + if (this.x != null) this.x.equals(null) + if (this.x != null) this.x.propT + if (this.x != null) this.x.propAny + if (this.x != null) this.x.propNullableT + if (this.x != null) this.x.propNullableAny + if (this.x != null) this.x.funT() + if (this.x != null) this.x.funAny() + if (this.x != null) this.x.funNullableT() + if (this.x != null) this.x.funNullableAny() + if (this.x != null) this.x + if (x != null) this.x.equals(null) + if (x != null) this.x.propT + if (x != null) this.x.propAny + if (x != null) this.x.propNullableT + if (x != null) this.x.propNullableAny + if (x != null) this.x.funT() + if (x != null) this.x.funAny() + if (x != null) this.x.funNullableT() + if (x != null) this.x.funNullableAny() + if (x != null) this.x + if (this.x != null) x.equals(null) + if (this.x != null) x.propT + if (this.x != null) x.propAny + if (this.x != null) x.propNullableT + if (this.x != null) x.propNullableAny + if (this.x != null) x.funT() + if (this.x != null) x.funAny() + if (this.x != null) x.funNullableT() + if (this.x != null) x.funNullableAny() + if (this.x != null) x + if (x != null || this.x != null) x.equals(null) + if (x != null || this.x != null) x.propT + if (x != null || this.x != null) x.propAny + if (x != null || this.x != null) x.propNullableT + if (x != null || this.x != null) x.propNullableAny + if (x != null || this.x != null) x.funT() + if (x != null || this.x != null) x.funAny() + if (x != null || this.x != null) x.funNullableT() + if (x != null || this.x != null) x.funNullableAny() + if (x != null || this.x != null) x + if (x != null || this.x != null) this.x.equals(null) + if (x != null || this.x != null) this.x.propT + if (x != null || this.x != null) this.x.propAny + if (x != null || this.x != null) this.x.propNullableT + if (x != null || this.x != null) this.x.propNullableAny + if (x != null || this.x != null) this.x.funT() + if (x != null || this.x != null) this.x.funAny() + if (x != null || this.x != null) this.x.funNullableT() + if (x != null || this.x != null) this.x.funNullableAny() + if (x != null || this.x != null) this.x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + if (this.y != null) this.y.equals(null) + if (this.y != null) this.y.propT + if (this.y != null) this.y.propAny + if (this.y != null) this.y.propNullableT + if (this.y != null) this.y.propNullableAny + if (this.y != null) this.y.funT() + if (this.y != null) this.y.funAny() + if (this.y != null) this.y.funNullableT() + if (this.y != null) this.y.funNullableAny() + if (this.y != null) this.y + if (this.y != null) y.equals(null) + if (this.y != null) y.propT + if (this.y != null) y.propAny + if (this.y != null) y.propNullableT + if (this.y != null) y.propNullableAny + if (this.y != null) y.funT() + if (this.y != null) y.funAny() + if (this.y != null) y.funNullableT() + if (this.y != null) y.funNullableAny() + if (this.y != null) y + if (y != null) this.y.equals(null) + if (y != null) this.y.propT + if (y != null) this.y.propAny + if (y != null) this.y.propNullableT + if (y != null) this.y.propNullableAny + if (y != null) this.y.funT() + if (y != null) this.y.funAny() + if (y != null) this.y.funNullableT() + if (y != null) this.y.funNullableAny() + if (y != null) this.y + if (y != null || this.y != null) y.equals(null) + if (y != null || this.y != null) y.propT + if (y != null || this.y != null) y.propAny + if (y != null || this.y != null) y.propNullableT + if (y != null || this.y != null) y.propNullableAny + if (y != null || this.y != null) y.funT() + if (y != null || this.y != null) y.funAny() + if (y != null || this.y != null) y.funNullableT() + if (y != null || this.y != null) y.funNullableAny() + if (y != null || this.y != null) y + if (y != null || this.y != null) this.y.equals(null) + if (y != null || this.y != null) this.y.propT + if (y != null || this.y != null) this.y.propAny + if (y != null || this.y != null) this.y.propNullableT + if (y != null || this.y != null) this.y.propNullableAny + if (y != null || this.y != null) this.y.funT() + if (y != null || this.y != null) this.y.funAny() + if (y != null || this.y != null) this.y.funNullableT() + if (y != null || this.y != null) this.y.funNullableAny() + if (y != null || this.y != null) this.y + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + if (this.u != null) this.u.equals(null) + if (this.u != null) this.u.propT + if (this.u != null) this.u.propAny + if (this.u != null) this.u.propNullableT + if (this.u != null) this.u.propNullableAny + if (this.u != null) this.u.funT() + if (this.u != null) this.u.funAny() + if (this.u != null) this.u.funNullableT() + if (this.u != null) this.u.funNullableAny() + if (this.u != null) this.u + if (this.u != null) u.equals(null) + if (this.u != null) u.propT + if (this.u != null) u.propAny + if (this.u != null) u.propNullableT + if (this.u != null) u.propNullableAny + if (this.u != null) u.funT() + if (this.u != null) u.funAny() + if (this.u != null) u.funNullableT() + if (this.u != null) u.funNullableAny() + if (this.u != null) u + if (u != null) this.u.equals(null) + if (u != null) this.u.propT + if (u != null) this.u.propAny + if (u != null) this.u.propNullableT + if (u != null) this.u.propNullableAny + if (u != null) this.u.funT() + if (u != null) this.u.funAny() + if (u != null) this.u.funNullableT() + if (u != null) this.u.funNullableAny() + if (u != null) this.u + if (u != null || this.u != null) u.equals(null) + if (u != null || this.u != null) u.propT + if (u != null || this.u != null) u.propAny + if (u != null || this.u != null) u.propNullableT + if (u != null || this.u != null) u.propNullableAny + if (u != null || this.u != null) u.funT() + if (u != null || this.u != null) u.funAny() + if (u != null || this.u != null) u.funNullableT() + if (u != null || this.u != null) u.funNullableAny() + if (u != null || this.u != null) u + if (u != null || this.u != null) this.u.equals(null) + if (u != null || this.u != null) this.u.propT + if (u != null || this.u != null) this.u.propAny + if (u != null || this.u != null) this.u.propNullableT + if (u != null || this.u != null) this.u.propNullableAny + if (u != null || this.u != null) this.u.funT() + if (u != null || this.u != null) this.u.funAny() + if (u != null || this.u != null) this.u.funNullableT() + if (u != null || this.u != null) this.u.funNullableAny() + if (u != null || this.u != null) this.u + + v = 0 + v.equals(null) + v.propT + v.propAny + v.propNullableT + v.propNullableAny + v.funT() + v.funAny() + v.funNullableT() + v.funNullableAny() + v + if (v != null) v.equals(null) + if (v != null) v.propT + if (v != null) v.propAny + if (v != null) v.propNullableT + if (v != null) v.propNullableAny + if (v != null) v.funT() + if (v != null) v.funAny() + if (v != null) v.funNullableT() + if (v != null) v.funNullableAny() + if (v != null) v + if (this.v != null) v.equals(null) + if (this.v != null) v.propT + if (this.v != null) v.propAny + if (this.v != null) v.propNullableT + if (this.v != null) v.propNullableAny + if (this.v != null) v.funT() + if (this.v != null) v.funAny() + if (this.v != null) v.funNullableT() + if (this.v != null) v.funNullableAny() + if (this.v != null) v + if (v != null || this.v != null) v.equals(null) + if (v != null || this.v != null) v.propT + if (v != null || this.v != null) v.propAny + if (v != null || this.v != null) v.propNullableT + if (v != null || this.v != null) v.propNullableAny + if (v != null || this.v != null) v.funT() + if (v != null || this.v != null) v.funAny() + if (v != null || this.v != null) v.funNullableT() + if (v != null || this.v != null) v.funNullableAny() + if (v != null || this.v != null) v + if (v != null || this.v != null) this.v.equals(null) + if (v != null || this.v != null) this.v.propT + if (v != null || this.v != null) this.v.propAny + if (v != null || this.v != null) this.v.propNullableT + if (v != null || this.v != null) this.v.propNullableAny + if (v != null || this.v != null) this.v.funT() + if (v != null || this.v != null) this.v.funAny() + if (v != null || this.v != null) this.v.funNullableT() + if (v != null || this.v != null) this.v.funNullableAny() + if (v != null || this.v != null) this.v + + w = if (null != null) 10 else null + if (w != null) w.equals(null) + if (w != null) w.propT + if (w != null) w.propAny + if (w != null) w.propNullableT + if (w != null) w.propNullableAny + if (w != null) w.funT() + if (w != null) w.funAny() + if (w != null) w.funNullableT() + if (w != null) w.funNullableAny() + if (w != null) w + if (this.w != null) w.equals(null) + if (this.w != null) w.propT + if (this.w != null) w.propAny + if (this.w != null) w.propNullableT + if (this.w != null) w.propNullableAny + if (this.w != null) w.funT() + if (this.w != null) w.funAny() + if (this.w != null) w.funNullableT() + if (this.w != null) w.funNullableAny() + if (this.w != null) w + if (w != null || this.w != null) w.equals(null) + if (w != null || this.w != null) w.propT + if (w != null || this.w != null) w.propAny + if (w != null || this.w != null) w.propNullableT + if (w != null || this.w != null) w.propNullableAny + if (w != null || this.w != null) w.funT() + if (w != null || this.w != null) w.funAny() + if (w != null || this.w != null) w.funNullableT() + if (w != null || this.w != null) w.funNullableAny() + if (w != null || this.w != null) w + if (w != null || this.w != null) this.w.equals(null) + if (w != null || this.w != null) this.w.propT + if (w != null || this.w != null) this.w.propAny + if (w != null || this.w != null) this.w.propNullableT + if (w != null || this.w != null) this.w.propNullableAny + if (w != null || this.w != null) this.w.funT() + if (w != null || this.w != null) this.w.funAny() + if (w != null || this.w != null) this.w.funNullableT() + if (w != null || this.w != null) this.w.funNullableAny() + if (w != null || this.w != null) this.w + + s = null + s.hashCode() + s + if (s != null) s.java + if (s != null) s + if (this.s != null) s.java + if (this.s != null) s + if (s != null || this.s != null) s.java + if (s != null || this.s != null) s + if (s != null || this.s != null) this.s.java + if (s != null || this.s != null) this.s + } + + fun test() { + if (x != null) x.equals(null) + if (x != null) x.propT + if (x != null) x.propAny + if (x != null) x.propNullableT + if (x != null) x.propNullableAny + if (x != null) x.funT() + if (x != null) x.funAny() + if (x != null) x.funNullableT() + if (x != null) x.funNullableAny() + if (x != null) x + + if (y != null) y.equals(null) + + if (y != null) y.propT + + if (y != null) y.propAny + + if (y != null) y.propNullableT + + if (y != null) y.propNullableAny + + if (y != null) y.funT() + + if (y != null) y.funAny() + + if (y != null) y.funNullableT() + + if (y != null) y.funNullableAny() + if (y != null) y + + if (u != null) u.equals(null) + + if (u != null) u.propT + + if (u != null) u.propAny + + if (u != null) u.propNullableT + + if (u != null) u.propNullableAny + + if (u != null) u.funT() + + if (u != null) u.funAny() + + if (u != null) u.funNullableT() + + if (u != null) u.funNullableAny() + if (u != null) u + + if (v != null) v.equals(null) + + if (v != null) v.propT + + if (v != null) v.propAny + + if (v != null) v.propNullableT + + if (v != null) v.propNullableAny + + if (v != null) v.funT() + + if (v != null) v.funAny() + + if (v != null) v.funNullableT() + + if (v != null) v.funNullableAny() + if (v != null) v + + if (w != null) w.equals(null) + + if (w != null) w.propT + + if (w != null) w.propAny + + if (w != null) w.propNullableT + + if (w != null) w.propNullableAny + + if (w != null) w.funT() + + if (w != null) w.funAny() + + if (w != null) w.funNullableT() + + if (w != null) w.funNullableAny() + if (w != null) w + + if (s != null) s.equals(null) + + if (s != null) s.propT + + if (s != null) s.propAny + + if (s != null) s.propNullableT + + if (s != null) s.propNullableAny + + if (s != null) s.funT() + + if (s != null) s.funAny() + + if (s != null) s.funNullableT() + + if (s != null) s.funNullableAny() + if (s != null) s + } +} + +fun case_32(a: Case32) { + if (a.x != null) a.x.equals(null) + if (a.x != null) a.x.propT + if (a.x != null) a.x.propAny + if (a.x != null) a.x.propNullableT + if (a.x != null) a.x.propNullableAny + if (a.x != null) a.x.funT() + if (a.x != null) a.x.funAny() + if (a.x != null) a.x.funNullableT() + if (a.x != null) a.x.funNullableAny() + if (a.x != null) a.x + if (a.v != null) a.v.equals(null) + if (a.v != null) a.v.propT + if (a.v != null) a.v.propAny + if (a.v != null) a.v.propNullableT + if (a.v != null) a.v.propNullableAny + if (a.v != null) a.v.funT() + if (a.v != null) a.v.funAny() + if (a.v != null) a.v.funNullableT() + if (a.v != null) a.v.funNullableAny() + if (a.v != null) a.v + if (a.w != null) a.w.equals(null) + if (a.w != null) a.w.propT + if (a.w != null) a.w.propAny + if (a.w != null) a.w.propNullableT + if (a.w != null) a.w.propNullableAny + if (a.w != null) a.w.funT() + if (a.w != null) a.w.funAny() + if (a.w != null) a.w.funNullableT() + if (a.w != null) a.w.funNullableAny() + if (a.w != null) a.w + if (a.s != null) a.s.equals(null) + if (a.s != null) a.s.propT + if (a.s != null) a.s.propAny + if (a.s != null) a.s.propNullableT + if (a.s != null) a.s.propNullableAny + if (a.s != null) a.s.funT() + if (a.s != null) a.s.funAny() + if (a.s != null) a.s.funNullableT() + if (a.s != null) a.s.funNullableAny() + if (a.s != null) a.s +} + +// TESTCASE NUMBER: 33 +fun case_33(a: Int?, b: Int = if (a != null) a else 0) { + a + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() + b +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.kt new file mode 100644 index 00000000000..9cc7acf7d1d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.kt @@ -0,0 +1,629 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 10 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, functions, properties + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + val x = expandInv(Inv(select(10, null))) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 2 +fun case_2() { + val x = expandOut(Out(select(10, null))) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + val x = expandInv(Inv(select(10, null))) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun case_4() { + val x = expandOut(Out(select(10, null))) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x = expandIn(In()) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 6 +fun case_6() { + val x = expandIn(In()) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: MutableMap) = select(x.values.first(), x.keys.first()) + +fun case_7() { + val x = case_7(mutableMapOf(10 to 10)) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: MutableMap) = select(x.values.first(), x.keys.first()) + +fun case_8() { + val x = case_8(mutableMapOf(10 to null)) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: MutableMap) = select(x.values.first(), x.keys.first()) + +fun case_9() { + val x = case_9(mutableMapOf(null to 10)) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: MutableMap) = select(x.values.first(), x.keys.first()) + +fun case_10() { + val x = case_10(mutableMapOf(10 to 10)) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: MutableMap) = select(x.values.first(), x.keys.first()) + +fun case_11() { + val x = case_11(mutableMapOf(10 to 10)) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: MutableMap) = select(x.values.first(), x.keys.first()) + +fun case_12() { + val x = case_12(mutableMapOf(10 to 11)) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 13 + * ISSUES: KT-28334 + * NOTE: before fix of the issue type is inferred to {Int? & Byte? & Short? & Long?} (smart cast from {Int? & Byte? & Short? & Long?}?) + */ +fun case_13(x: Out?, y: Out) = select(x, y) + +fun case_13() { + val x = case_13(Out(), Out()) + + if (x != null) { + & Out?")!>x + & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>x.propT + & Out?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + val y = x.get() + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 14 +fun case_14(x: Out?, y: Out) = select(x, y) + +fun case_14() { + val x = case_14(Out(), Out()) + + if (x != null) { + & Out?")!>x + & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>x.propT + & Out?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + val y = x.get() + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: Out, y: Out?) = select(x, y) + +fun case_15() { + val x = case_15(Out(), Out()) + + if (x != null) { + & Out?")!>x + & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>x.propT + & Out?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + val y = x.get() + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 16 + * ISSUES: KT-28334 + * NOTE: before fix of the issue type is inferred to {Int? & Byte? & Short? & Long?} (smart cast from {Int? & Byte? & Short? & Long?}?) + */ +fun case_16(x: Out, y: Out) = select(x, select(y, null)) + +fun case_16() { + val x = case_16(Out(), Out()) + + if (x != null) { + & Out?")!>x + & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>x.propT + & Out?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + val y = x.get() + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 17 +fun case_17(x: Out, y: Out) = select(x, select(y, null)) + +fun case_17() { + val x = case_17(Out(), Out()) + + if (x != null) { + & Out?")!>x + & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>x.propT + & Out?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + val y = x.get() + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 18 + * ISSUES: KT-28334 + * NOTE: before fix of the issue type is inferred to {Int? & Byte? & Short? & Long?} (smart cast from {Int? & Byte? & Short? & Long?}?) + */ +fun case_18(x: Out, y: Out) = select(x, y) + +fun case_18() { + val x = case_18(Out(), Out()) + + ")!>x + ")!>x.equals(null) + ")!>x.propT + ")!>x.propAny + ")!>x.propNullableT + ")!>x.propNullableAny + ")!>x.funT() + ")!>x.funAny() + ")!>x.funNullableT() + ")!>x.funNullableAny() + val y = x.get() + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } +} + +// TESTCASE NUMBER: 19 +fun case_19(x: Out, y: Out) = select(x, y) + +fun case_19() { + val x = case_19(Out(), Out()) + + ")!>x + ")!>x.equals(null) + ")!>x.propT + ")!>x.propAny + ")!>x.propNullableT + ")!>x.propNullableAny + ")!>x.funT() + ")!>x.funAny() + ")!>x.funNullableT() + ")!>x.funNullableAny() + val y = x.get() + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } +} + +// TESTCASE NUMBER: 20 +fun case_20(x: Out, y: Out) = select(x.get(), y.get()) + +fun case_20(y: Int?) { + val x = case_20(Out(y), Out()) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 21 +fun case_21(x: Out, y: Out) = select(x.get(), y.get()) + +fun case_21(y: Int?) { + val x = case_21(Out(y), Out()) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 22 +fun case_22(x: Out, y: Out): T? = select(x.get(), y.get()) + +fun case_22(y: Int?) { + val x = case_22(Out(y), Out()) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 23 +fun case_23(x: Out, y: Out): T = select(x.get(), y.get()) + +fun case_23(y: Int?) { + val x = case_13(Out(y), Out()) + + if (x != null) { + & Out?")!>x + & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>x.propT + & Out?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 24 +fun case_24(x: Out, y: Out) where F : E? = select(x.get(), y.get()) + +fun case_24(y: Int) { + val x = case_13(Out(y), Out()) + + if (x != null) { + & Out?")!>x + & Out?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>x.propT + & Out?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 25 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29054 + */ +fun , C: Out, D: Out, E: Out, F> case_25(x: F, y: Out) where F : Out = + select(x.get()?.get()?.get()?.get()?.get(), y.get().get().get()) + +fun case_25(y: Int) { + val x = case_25(Out(Out(Out(Out(Out(y))))), Out(Out(Out(y)))) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 26 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29054 + */ +fun , C: Out, D: Out, E: Out, F> case_26(x: F, y: Out) where F : Out = + select(x.get()?.get()?.get()?.get()?.get(), y.get().get().get()) + +fun case_26(y: Int) { + val x = case_26(Out(Out(Out(Out(Out(y))))), Out(Out(Out(y)))) + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.kt new file mode 100644 index 00000000000..a55a2db28b4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.kt @@ -0,0 +1,278 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 11 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, functions, interfaces, properties + */ + +// TESTCASE NUMBER: 1 +fun , C: Out> case_1(a: C, b: B) = select(a.x, b.x) + +fun case_1() { + val x = case_1(Out(10), Inv(0.1)) + + if (x != null) { + & Number} & {Comparable<{Double & Int}> & Number}?")!>x + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.propT + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.propNullableT + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.propNullableAny + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.funNullableT() + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 2 +fun , C: Out> case_2(a: C, b: B) = select(a.x, b.x) + +fun case_2(y: Int) { + val x = case_2(Out(y), Inv(0.1)) + + if (x != null) { + & Number} & {Comparable<{Double & Int}> & Number}?")!>x + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.propT + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.propNullableT + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.propNullableAny + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Number} & {Comparable<{Double & Int}> & Number}?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.funNullableT() + & Number} & {Comparable<{Double & Int}> & Number}?")!>x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-28670 + */ +fun case_3(a: Int?, b: Float?, c: Double?, d: Boolean?) { + when (d) { + true -> a + false -> b + null -> c + }.apply { + ? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this + if (this != null) { + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this + & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this.equals(null) + & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this.propT + & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this.propAny + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this.propNullableT + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this.propNullableAny + & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this.funT() + & Number}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>this.funAny() + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this.funNullableT() + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_EXPRESSION_TYPE("{Comparable<{Double & Float & Int}>? & Number?}")!>this.funNullableAny() + } + }.let { + ? & Number?}")!>it + if (it != null) { + & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it.equals(null) + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it.propT + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it.propAny + & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it.propNullableT + & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it.propNullableAny + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it.funT() + & Number} & {Comparable<{Double & Float & Int}>? & Number?}"), DEBUG_INFO_SMARTCAST!>it.funAny() + & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it.funNullableT() + & Number} & {Comparable<{Double & Float & Int}>? & Number?}")!>it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-28670 + */ +fun case_4(a: Interface1?, b: Interface2?, c: Boolean) { + a as Interface2? + b as Interface1? + val x = when (c) { + true -> a + false -> b + } + + x.apply { + this + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + } + } + x.let { + it + if (it != null) { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 5 + * ISSUES: KT-28670 + */ +fun case_5(a: Interface1?, b: Interface2?, d: Boolean) { + a as Interface2? + b as Interface1 + val x = when (d) { + true -> a + false -> b + } + + x.apply { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + } + } + x.let { + if (it != null) { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 6 + * ISSUES: KT-28670 + */ +fun case_6(a: Interface1?, b: Interface2, d: Boolean) { + a as Interface2? + b as Interface1 + val x = when (d) { + true -> a + false -> b + } + + x.apply { + this as Interface3 + this + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + this.itest2() + } + } + x.let { + it as Interface3 + it + if (it != null) { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.itest1() + it.itest2() + } + } +} + +/* + * TESTCASE NUMBER: 7 + * ISSUES: KT-28670 + */ +fun case_7(a: Interface1?, b: Interface2?, d: Boolean) { + a as Interface2? + b as Interface1? + val x = when (d) { + true -> a + false -> b + } + + x.apply { + this as Interface3? + this + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + this.itest2() + } + } + x.let { + it as Interface3? + it + if (it != null) { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.itest1() + it.itest2() + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.kt new file mode 100644 index 00000000000..6a0febc9e6c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.kt @@ -0,0 +1,3914 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 12 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, interfaces, properties, functions + */ + +// TESTCASE NUMBER: 1 +fun T.case_1() { + if (this != null) { + equals(this) + apply { equals(null) } + apply { propT } + apply { propAny } + apply { propNullableT } + apply { propNullableAny } + apply { funT() } + apply { funAny() } + apply { funNullableT() } + apply { funNullableAny(); this.equals(null) } + also { it.equals(null) } + also { it.propT } + also { it.propAny } + also { it.propNullableT } + also { it.propNullableAny } + also { it.funT() } + also { it.funAny() } + also { it.funNullableT() } + also { it.funNullableAny() } + } +} + +// TESTCASE NUMBER: 2 +fun T?.case_2() { + if (this != null) { + equals(this) + apply { equals(null) } + apply { propT } + apply { propAny } + apply { propNullableT } + apply { propNullableAny } + apply { funT() } + apply { funAny() } + apply { funNullableT() } + apply { funNullableAny(); this.equals(null) } + also { it.equals(null) } + also { it.propT } + also { it.propAny } + also { it.propNullableT } + also { it.propNullableAny } + also { it.funT() } + also { it.funAny() } + also { it.funNullableT() } + also { it.funNullableAny() } + } +} + +// TESTCASE NUMBER: 3 +fun T.case_3() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun T?.case_4() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun T?.case_5() { + if (this is Interface1) { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + + equals(this) + itest1() + apply { + this + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + } + also { + it + it + it.itest1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 6 +fun T?.case_6() { + if (this is Interface1?) { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + + equals(this) + itest1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + } + also { + it + it.itest1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 7 +fun T.case_7() { + val x = this + if (x is Interface1?) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest1() + + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + } + x.also { + it + it.itest1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 8 +fun T.case_8() { + if (this != null) { + if (this is Interface1?) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + + equals(this) + itest1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + } + also { + it + it.itest1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 9 +fun T.case_9() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.toByte() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + toByte() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.toByte() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.toByte() + } + } +} + +// TESTCASE NUMBER: 10 +fun T.case_10() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.toByte() + + equals(this) + toByte() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.toByte() + } + also { + it + it.toByte() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 11 +fun T?.case_11() { + if (this is Interface1?) { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + + equals(this) + itest1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + } + also { + it + it.itest1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 12 +fun T.case_12() where T : Number?, T: Interface1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + this.toByte() + + equals(this) + itest1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + } + also { + it + it.itest1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T.case_13() where T : Out<*>?, T: Comparable { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.compareTo(null) + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + get() + compareTo(null) + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + compareTo(null) + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.compareTo(null) + } + also { + it + it.get() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.compareTo(null) + } + } +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> T.case_14() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + + equals(this) + get() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + } + also { + it + it.get() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 15 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> T.case_15() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + + equals(this) + itest1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + } + also { + it + it.itest1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 16 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> T.case_16() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + + equals(this) + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> T.case_17() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + + equals(this) + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 18 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> T.case_18() { + val y = this + + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + y.ip1test1() + + equals(y) + ip1test1() + apply { + this + equals(this) + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 19 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> T.case_19() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + + equals(this) + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 20 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T.case_20() where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + this.ip1test2() + + equals(this) + ip1test1() + ip1test2() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + ip1test2() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + this.ip1test2() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + it.ip1test2() + } + } +} + +/* + * TESTCASE NUMBER: 21 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T.case_21() where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2?, T: InterfaceWithTypeParameter3? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + this.ip1test2() + this.ip1test3() + + equals(this) + ip1test1() + ip1test2() + ip1test3() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + ip1test2() + ip1test3() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + this.ip1test2() + this.ip1test3() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + it.ip1test2() + it.ip1test3() + } + } +} + +/* + * TESTCASE NUMBER: 22 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun >?> T.case_22() { + var y = this + + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + y.ip1test1() + + equals(y) + ip1test1() + apply { + this + equals(this) + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 23 +fun >?> T.case_23() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + + equals(this) + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 24 +fun > InterfaceWithTypeParameter1?.case_24() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.ip1test1() + + equals(this) + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 25 +fun > InterfaceWithTypeParameter1?.case_25() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>this.ip1test1() + + equals(this) + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 26 +fun > InterfaceWithTypeParameter1?.case_26() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 27 +fun > InterfaceWithTypeParameter1?.case_27() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 28 +fun > InterfaceWithTypeParameter1?.case_28() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 29 +fun > InterfaceWithTypeParameter1?.case_29() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 30 +fun > InterfaceWithTypeParameter1?.case_30() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 31 +fun > InterfaceWithTypeParameter1?.case_31() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 32 +fun Map?.case_32() { + if (this != null) { + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(null) + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 33 +fun InterfaceWithFiveTypeParameters1?.case_33() { + if (this != null) { + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.equals(null) + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propT + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propAny + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propNullableT + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propNullableAny + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funT() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funAny() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funNullableT() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funNullableAny() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.itest() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + itest() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.itest() + } + } +} + +// TESTCASE NUMBER: 34 +fun InterfaceWithTypeParameter1?.case_34() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 35 +fun InterfaceWithTypeParameter1?.case_35() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 36 +fun InterfaceWithTypeParameter1?.case_36() { + if (this != null) { + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1?")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + ip1test1() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 37 +fun Map?.case_37() { + if (this != null) { + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(null) + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 38 +fun Map<*, out T>?.case_38() { + if (this != null) { + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.equals(null) + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.propT + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.propAny + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.propNullableT + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.propNullableAny + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.funT() + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.funAny() + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.funNullableT() + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.funNullableAny() + & kotlin.collections.Map<*, out T>?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map<*, out T>?")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 39 +fun InterfaceWithTwoTypeParameters?.case_39() { + if (this != null) { + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.equals(null) + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propT + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propAny + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propNullableT + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propNullableAny + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funT() + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funAny() + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funNullableT() + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funNullableAny() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableAny() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 40 +fun InterfaceWithTwoTypeParameters?.case_40() { + if (this != null) { + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.equals(null) + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propT + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propAny + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propNullableT + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.propNullableAny + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funT() + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funAny() + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funNullableT() + & InterfaceWithTwoTypeParameters?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters?")!>this.funNullableAny() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableAny() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 41 +fun Mapout T>?.case_41() { + if (this != null) { + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(null) + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 42 +fun Mapout T>?.case_42() { + if (this != null) { + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(null) + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 43 +fun Map?.case_43() { + if (this != null) { + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.equals(null) + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableT + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.propNullableAny + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableT() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.funNullableAny() + & kotlin.collections.Map?"), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map?")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 44 +fun InterfaceWithFiveTypeParameters1?.case_44() { + if (this != null) { + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.equals(null) + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propT + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propAny + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propNullableT + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.propNullableAny + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funT() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funAny() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funNullableT() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.funNullableAny() + & InterfaceWithFiveTypeParameters1?"), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1?")!>this.itest() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + itest() + apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() + } + also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.itest() + } + } +} + +// TESTCASE NUMBER: 45 +fun T.case_45() where T : Number?, T: Comparable? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.toByte() + this.compareTo(this) + + equals(this) + toByte() + compareTo(this) + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + compareTo(this) + toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.compareTo(this) + this.toByte() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.compareTo(it) + it.toByte() + } + } +} + +// TESTCASE NUMBER: 46 +fun T.case_46() where T : CharSequence?, T: Comparable?, T: Iterable<*>? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.compareTo(this) + this.get(0) + this.iterator() + + equals(this) + compareTo(this) + get(0) + iterator() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + compareTo(this) + get(0) + iterator() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.compareTo(this) + this.get(0) + this.iterator() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.compareTo(it) + it.get(0) + it.iterator() + } + } +} + +/* + * TESTCASE NUMBER: 47 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T?.case_47() where T : Inv, T: Comparable<*>?, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + + this.compareTo(return) + compareTo(return) + + apply { + compareTo(return) + this.compareTo(return) + } + + also { + it.compareTo(return) + } + } +} + +/* + * TESTCASE NUMBER: 48 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T?.case_48() where T : Inv, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 49 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T?.case_49() where T : Inv, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 50 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T?.case_50() where T : Inv, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 51 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T?.case_51() where T : Inv, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 52 +fun T?.case_52() where T : Inv, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 53 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T?.case_53() where T : Inv, T: InterfaceWithTypeParameter1<*>? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 54 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T?.case_54() where T : Inv<*>, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 55 +fun T?.case_55() where T : Inv<*>, T: InterfaceWithTypeParameter1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + + equals(this) + get() + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 56 +fun T.case_56() where T : Number?, T: Interface1? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + this.toByte() + + equals(this) + itest() + toByte() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + this.toByte() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.itest() + it.toByte() + } + } +} + +/* + * TESTCASE NUMBER: 57 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T.case_57() where T : Out<*>?, T: Comparable { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.compareTo(null) + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + get() + compareTo(null) + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + compareTo(null) + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.compareTo(null) + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.compareTo(null) + } + } +} + +// TESTCASE NUMBER: 58 +fun >>>>>>>>>?> T.case_59() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + + equals(this) + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 59 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T.case_59() where T: InterfaceWithFiveTypeParameters1?, T: InterfaceWithFiveTypeParameters2?, T: InterfaceWithFiveTypeParameters3? { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + this.itest2() + this.itest3() + + equals(this) + itest1() + itest2() + itest3() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + itest2() + itest3() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + this.itest2() + this.itest3() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.itest1() + it.itest2() + it.itest3() + } + } +} + +/* + * TESTCASE NUMBER: 60 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> T.case_60() { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + + equals(this) + ip1test1() + apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 61 +interface Case61_1: InterfaceWithTypeParameter1, Case61_2 { fun test1() } +interface Case61_2: InterfaceWithTypeParameter1 { fun test2() } + +class Case61_3: InterfaceWithTypeParameter1, Case61_1, Case61_2 { + override fun test1() {} + override fun test2() {} + fun test4() {} +} + +fun T.case_61() where T : InterfaceWithTypeParameter1?, T: Case61_3?, T: Case61_1?, T: Case61_2? { + if (this != null) { + this.test1() + this.test2() + this.ip1test1() + this.test4() + + test1() + test2() + ip1test1() + test4() + apply { + this + test1() + test2() + ip1test1() + test4() + this.test1() + this.test2() + this.ip1test1() + this.test4() + } + also { + it + it.test1() + it.test2() + it.ip1test1() + it.test4() + } + } +} + +// TESTCASE NUMBER: 62 +fun Nothing?.case_62() { + if (this != null) { + this + this.hashCode() + + hashCode() + apply { + this + hashCode() + this.hashCode() + } + also { + it + it.hashCode() + } + } +} + +// TESTCASE NUMBER: 63 +fun Nothing.case_63() { + if (this != null) { + this + this.hashCode() + + hashCode() + apply { + this + hashCode() + this.hashCode() + } + also { + it + it.hashCode() + } + } +} + +/* + * TESTCASE NUMBER: 64 + * UNEXPECTED BEHAVIOUR + */ +fun T.case_64() { + if (this != null) { + this + this.hashCode() + + hashCode() + apply { + this + hashCode() + this.hashCode() + } + also { + it + it.hashCode() + } + } +} + +/* + * TESTCASE NUMBER: 65 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun T.case_65() { + if (this is Interface1?) { + if (this is Interface2?) { + if (this != null) { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + apply { + this + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + } + also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.kt new file mode 100644 index 00000000000..184a170fe40 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.kt @@ -0,0 +1,4384 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 13 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, interfaces, properties, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: T) { + var y = null + + if (y != x) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.apply { equals(null) } + x.apply { propT } + x.apply { propAny } + x.apply { propNullableT } + x.apply { propNullableAny } + x.apply { funT() } + x.apply { funAny() } + x.apply { funNullableT() } + x.apply { funNullableAny(); x.equals(null) } + x.also { it.equals(null) } + x.also { it.propT } + x.also { it.propAny } + x.also { it.propNullableT } + x.also { it.propNullableAny } + x.also { it.funT() } + x.also { it.funAny() } + x.also { it.funNullableT() } + x.also { it.funNullableAny() } + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: T?, y: Nothing?) { + if (y != x) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.apply { equals(null) } + x.apply { propT } + x.apply { propAny } + x.apply { propNullableT } + x.apply { propNullableAny } + x.apply { funT() } + x.apply { funAny() } + x.apply { funNullableT() } + x.apply { funNullableAny(); x.equals(null) } + x.also { it.equals(null) } + x.also { it.propT } + x.also { it.propAny } + x.also { it.propNullableT } + x.also { it.propNullableAny } + x.also { it.funT() } + x.also { it.funAny() } + x.also { it.funNullableT() } + x.also { it.funNullableAny() } + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: T?) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: T?) { + if (x is Interface1) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + this + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + } + x.also { + it + it + it.itest() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: T?) { + if (x is Interface1?) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + } + x.also { + it + it.itest() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 7 +fun case_7(y: T) { + val x = y + if (x is Interface1?) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + } + x.also { + it + it.itest() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: T) { + if (x != null) { + if (x is Interface1?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + } + x.also { + it + it.itest() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.toByte() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.toByte() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + x.toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.toByte() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.toByte() + } + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.toByte() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.toByte() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.toByte() + } + x.also { + it + it.toByte() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: T?) { + if (x is Interface1?) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + } + x.also { + it + it.itest() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: T) where T : Number?, T: Interface1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + x.toByte() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + } + x.also { + it + it.itest() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_13(x: T) where T : Out<*>?, T: Comparable { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.get() + x.compareTo(null) + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.get() + x.compareTo(null) + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + compareTo(null) + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.compareTo(null) + } + x.also { + it + it.get() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.compareTo(null) + } + } +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> case_14(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.get() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.get() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + } + x.also { + it + it.get() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 15 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> case_15(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + } + x.also { + it + it.itest() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 16 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> case_16(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> case_17(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 18 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> case_18(x: T) { + val y = x + + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + y.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 19 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> case_19(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.ip1test1() + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 20 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_20(x: T) where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + x.ip1test2() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.ip1test2() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + ip1test2() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + this.ip1test2() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + it.ip1test2() + } + } +} + +/* + * TESTCASE NUMBER: 21 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_21(x: T) where T: InterfaceWithTypeParameter1?, T: InterfaceWithTypeParameter2?, T: InterfaceWithTypeParameter3? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + x.ip1test2() + x.ip1test3() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.ip1test2() + x.ip1test3() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + ip1test2() + ip1test3() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + this.ip1test2() + this.ip1test3() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + it.ip1test2() + it.ip1test3() + } + } +} + +/* + * TESTCASE NUMBER: 22 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun >?> case_22(x: T) { + var y = x + + if (y != null) { + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + y.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(this) + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 23 +fun >?> case_23(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 24 +fun > case_24(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 25 +fun > case_25(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.propT + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.funT() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?"), DEBUG_INFO_SMARTCAST!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 26 +fun > case_26(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 27 +fun > case_27(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 28 +fun > case_28(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 29 +fun > case_29(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 30 +fun > case_30(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 31 +fun > case_31(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 32 +fun case_32(x: Map?) { + if (x != null) { + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() + & kotlin.collections.Map?")!>x.isEmpty() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.isEmpty() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 33 +fun case_33(x: InterfaceWithFiveTypeParameters1?) { + if (x != null) { + & InterfaceWithFiveTypeParameters1?")!>x + & InterfaceWithFiveTypeParameters1?")!>x.equals(null) + & InterfaceWithFiveTypeParameters1?")!>x.propT + & InterfaceWithFiveTypeParameters1?")!>x.propAny + & InterfaceWithFiveTypeParameters1?")!>x.propNullableT + & InterfaceWithFiveTypeParameters1?")!>x.propNullableAny + & InterfaceWithFiveTypeParameters1?")!>x.funT() + & InterfaceWithFiveTypeParameters1?")!>x.funAny() + & InterfaceWithFiveTypeParameters1?")!>x.funNullableT() + & InterfaceWithFiveTypeParameters1?")!>x.funNullableAny() + & InterfaceWithFiveTypeParameters1?")!>x.itest() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.itest() + } + } +} + +// TESTCASE NUMBER: 34 +fun case_34(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 35 +fun case_35(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 36 +fun case_36(x: InterfaceWithTypeParameter1?) { + if (x != null) { + & InterfaceWithTypeParameter1?")!>x + & InterfaceWithTypeParameter1?")!>x.equals(null) + & InterfaceWithTypeParameter1?")!>x.propT + & InterfaceWithTypeParameter1?")!>x.propAny + & InterfaceWithTypeParameter1?")!>x.propNullableT + & InterfaceWithTypeParameter1?")!>x.propNullableAny + & InterfaceWithTypeParameter1?")!>x.funT() + & InterfaceWithTypeParameter1?")!>x.funAny() + & InterfaceWithTypeParameter1?")!>x.funNullableT() + & InterfaceWithTypeParameter1?")!>x.funNullableAny() + & InterfaceWithTypeParameter1?")!>x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTypeParameter1")!>this.ip1test1() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 37 +fun case_37(x: Map?) { + if (x != null) { + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() + & kotlin.collections.Map?")!>x.isEmpty() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.isEmpty() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 38 +fun case_38(x: Map<*, out T>?) { + if (x != null) { + & kotlin.collections.Map<*, out T>?")!>x + & kotlin.collections.Map<*, out T>?")!>x.equals(null) + & kotlin.collections.Map<*, out T>?")!>x.propT + & kotlin.collections.Map<*, out T>?")!>x.propAny + & kotlin.collections.Map<*, out T>?")!>x.propNullableT + & kotlin.collections.Map<*, out T>?")!>x.propNullableAny + & kotlin.collections.Map<*, out T>?")!>x.funT() + & kotlin.collections.Map<*, out T>?")!>x.funAny() + & kotlin.collections.Map<*, out T>?")!>x.funNullableT() + & kotlin.collections.Map<*, out T>?")!>x.funNullableAny() + & kotlin.collections.Map<*, out T>?")!>x.isEmpty() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.isEmpty() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 39 +fun case_39(x: InterfaceWithTwoTypeParameters?) { + if (x != null) { + & InterfaceWithTwoTypeParameters?")!>x + & InterfaceWithTwoTypeParameters?")!>x.equals(null) + & InterfaceWithTwoTypeParameters?")!>x.propT + & InterfaceWithTwoTypeParameters?")!>x.propAny + & InterfaceWithTwoTypeParameters?")!>x.propNullableT + & InterfaceWithTwoTypeParameters?")!>x.propNullableAny + & InterfaceWithTwoTypeParameters?")!>x.funT() + & InterfaceWithTwoTypeParameters?")!>x.funAny() + & InterfaceWithTwoTypeParameters?")!>x.funNullableT() + & InterfaceWithTwoTypeParameters?")!>x.funNullableAny() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableAny() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 40 +fun case_40(x: InterfaceWithTwoTypeParameters?) { + if (x != null) { + & InterfaceWithTwoTypeParameters?")!>x + & InterfaceWithTwoTypeParameters?")!>x.equals(null) + & InterfaceWithTwoTypeParameters?")!>x.propT + & InterfaceWithTwoTypeParameters?")!>x.propAny + & InterfaceWithTwoTypeParameters?")!>x.propNullableT + & InterfaceWithTwoTypeParameters?")!>x.propNullableAny + & InterfaceWithTwoTypeParameters?")!>x.funT() + & InterfaceWithTwoTypeParameters?")!>x.funAny() + & InterfaceWithTwoTypeParameters?")!>x.funNullableT() + & InterfaceWithTwoTypeParameters?")!>x.funNullableAny() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithTwoTypeParameters")!>this.funNullableAny() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 41 +fun case_41(x: Mapout T>?) { + if (x != null) { + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() + & kotlin.collections.Map?")!>x.isEmpty() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.isEmpty() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 42 +fun case_42(x: Mapout T>?) { + if (x != null) { + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() + & kotlin.collections.Map?")!>x.isEmpty() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.isEmpty() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 43 +fun case_43(x: Map?) { + if (x != null) { + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() + & kotlin.collections.Map?")!>x.isEmpty() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.isEmpty() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.collections.Map")!>this.isEmpty() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.isEmpty() + } + } +} + +// TESTCASE NUMBER: 44 +fun case_44(x: InterfaceWithFiveTypeParameters1?) { + if (x != null) { + & InterfaceWithFiveTypeParameters1?")!>x + & InterfaceWithFiveTypeParameters1?")!>x.equals(null) + & InterfaceWithFiveTypeParameters1?")!>x.propT + & InterfaceWithFiveTypeParameters1?")!>x.propAny + & InterfaceWithFiveTypeParameters1?")!>x.propNullableT + & InterfaceWithFiveTypeParameters1?")!>x.propNullableAny + & InterfaceWithFiveTypeParameters1?")!>x.funT() + & InterfaceWithFiveTypeParameters1?")!>x.funAny() + & InterfaceWithFiveTypeParameters1?")!>x.funNullableT() + & InterfaceWithFiveTypeParameters1?")!>x.funNullableAny() + & InterfaceWithFiveTypeParameters1?")!>x.itest() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.apply { + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.equals(null) + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableT + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.propNullableAny + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableT() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.funNullableAny() + "), DEBUG_INFO_EXPRESSION_TYPE("InterfaceWithFiveTypeParameters1")!>this.itest() + } + x.also { + ")!>it + ")!>it.equals(null) + ")!>it.propT + ")!>it.propAny + ")!>it.propNullableT + ")!>it.propNullableAny + ")!>it.funT() + ")!>it.funAny() + ")!>it.funNullableT() + ")!>it.funNullableAny() + ")!>it.itest() + } + } +} + +// TESTCASE NUMBER: 45 +fun case_45(x: T) where T : Number?, T: Comparable? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.toByte() + x.compareTo(x) + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.toByte() + x.compareTo(x) + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + compareTo(this) + x.toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.compareTo(x) + this.toByte() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.compareTo(it) + it.toByte() + } + } +} + +// TESTCASE NUMBER: 46 +fun case_46(x: T) where T : CharSequence?, T: Comparable?, T: Iterable<*>? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.compareTo(x) + x.get(0) + x.iterator() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.compareTo(x) + x.get(0) + x.iterator() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + compareTo(this) + get(0) + iterator() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.compareTo(x) + this.get(0) + this.iterator() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.compareTo(it) + it.get(0) + it.iterator() + } + } +} + +/* + * TESTCASE NUMBER: 47 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_47(x: T?) where T : Inv, T: Comparable<*>?, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + + x.compareTo(return) + x.compareTo(return) + + x.apply { + compareTo(return) + this.compareTo(return) + } + + x.also { + it.compareTo(return) + } + } +} + +/* + * TESTCASE NUMBER: 48 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_48(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 49 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_49(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 50 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_50(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 51 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_51(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 52 +fun case_52(x: T?) where T : Inv, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 53 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_53(x: T?) where T : Inv, T: InterfaceWithTypeParameter1<*>? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 54 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_54(x: T?) where T : Inv<*>, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 55 +fun case_55(x: T?) where T : Inv<*>, T: InterfaceWithTypeParameter1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.test() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + test() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.test() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.test() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 56 +fun case_56(x: T) where T : Number?, T: Interface1? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest() + x.toByte() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest() + x.toByte() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest() + x.toByte() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest() + this.toByte() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.itest() + it.toByte() + } + } +} + +/* + * TESTCASE NUMBER: 57 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_57(x: T) where T : Out<*>?, T: Comparable { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.get() + x.compareTo(null) + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.get() + x.compareTo(null) + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + get() + compareTo(null) + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.get() + this.compareTo(null) + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.get() + it.compareTo(null) + } + } +} + +// TESTCASE NUMBER: 58 +fun >>>>>>>>>?> case_59(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +/* + * TESTCASE NUMBER: 59 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_59(x: T) where T: InterfaceWithFiveTypeParameters1?, T: InterfaceWithFiveTypeParameters2?, T: InterfaceWithFiveTypeParameters3? { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.itest1() + x.itest2() + x.itest3() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.itest1() + x.itest2() + x.itest3() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + itest1() + itest2() + itest3() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.itest1() + this.itest2() + this.itest3() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.itest1() + it.itest2() + it.itest3() + } + } +} + +/* + * TESTCASE NUMBER: 60 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun ?> case_60(x: T) { + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.ip1test1() + + x.equals(null) + + x.propT + + x.propAny + + x.propNullableT + + x.propNullableAny + + x.funT() + + x.funAny() + + x.funNullableT() + + x.funNullableAny() + x.ip1test1() + x.apply { + this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ip1test1() + this.equals(null) + this.propT + this.propAny + this.propNullableT + this.propNullableAny + this.funT() + this.funAny() + this.funNullableT() + this.funNullableAny() + this.ip1test1() + } + x.also { + it + it.equals(null) + it.propT + it.propAny + it.propNullableT + it.propNullableAny + it.funT() + it.funAny() + it.funNullableT() + it.funNullableAny() + it.ip1test1() + } + } +} + +// TESTCASE NUMBER: 61 +interface Case61_1: InterfaceWithTypeParameter1, Case61_2 { fun test1() } +interface Case61_2: InterfaceWithTypeParameter1 { fun test2() } + +class Case61_3: InterfaceWithTypeParameter1, Case61_1, Case61_2 { + override fun test1() {} + override fun test2() {} + fun test4() {} +} + +fun T.case_61(x: T) where T : InterfaceWithTypeParameter1?, T: Case61_3?, T: Case61_1?, T: Case61_2? { + if (x != null) { + x.ip1test1() + x.test2() + x.ip1test1() + x.test4() + + x.ip1test1() + x.test2() + x.ip1test1() + x.test4() + x.apply { + this + ip1test1() + test2() + ip1test1() + test4() + this.ip1test1() + this.test2() + this.ip1test1() + this.test4() + } + x.also { + it + it.ip1test1() + it.test2() + it.ip1test1() + it.test4() + } + } +} + +/* + * TESTCASE NUMBER: 62 + * UNEXPECTED BEHAVIOUR + */ +fun case_62(x: T) { + if (x != null) { + x + x.hashCode() + + x.hashCode() + x.apply { + this + hashCode() + this.hashCode() + } + x.also { + it + it.hashCode() + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.14.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.kt similarity index 70% rename from compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.14.kt rename to compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.kt index fa859ba71d1..cc73ab02acb 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.14.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.kt @@ -3,17 +3,11 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 + * SECTIONS: dfa * NUMBER: 14 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) using if expression and vararg. + * DESCRIPTION: Raw data flow analysis test */ // TESTCASE NUMBER: 1 @@ -28,7 +22,7 @@ fun case_1(vararg x: Int?) { fun case_2(vararg x: Int?) { x[0].apply { if (this != null) { - this + this this.inv() } } @@ -53,7 +47,7 @@ fun case_3(vararg x: T?) { fun case_4(vararg x: T?) { x[0].apply { if (this != null) { - this + this this.toByte() } } diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.15.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.kt similarity index 63% rename from compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.15.kt rename to compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.kt index 847347695cd..fa271be4fb0 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.15.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.kt @@ -3,19 +3,13 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 + * SECTIONS: dfa * NUMBER: 15 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) on big types using if expression. + * DESCRIPTION: Raw data flow analysis test * NOTE: performance test - * HELPERS: classes, interfaces, functions + * HELPERS: classes, interfaces, functions, properties */ // TESTCASE NUMBER: 1 @@ -45,6 +39,14 @@ fun case_1() { val g = & InterfaceWithTypeParameter1<*>?")!>f.ip1test1() if (g != null) { g.equals(null) + g.propT + g.propAny + g.propNullableT + g.propNullableAny + g.funT() + g.funAny() + g.funNullableT() + g.funNullableAny() } } } @@ -55,29 +57,29 @@ fun case_1() { } // TESTCASE NUMBER: 2 -class Case2_1 : Interface1, InterfaceWithTypeParameter1 -class Case2_2 : Interface1, InterfaceWithTypeParameter1 +class Case2_1 : Interface3, InterfaceWithTypeParameter1 +class Case2_2 : Interface3, InterfaceWithTypeParameter1 fun case_2() { val x = select(Case2_1(), Case2_2(), null) if (x != null) { - }>}>}>}>} & {Interface1? & InterfaceWithTypeParameter1}>}>}>}>?}")!>x - }>}>}>}>} & {Interface1? & InterfaceWithTypeParameter1}>}>}>}>?}")!>x.ip1test1() + }>}>}>}>} & {Interface3? & InterfaceWithTypeParameter1}>}>}>}>?}")!>x + }>}>}>}>} & {Interface3? & InterfaceWithTypeParameter1}>}>}>}>?}")!>x.ip1test1() } } // TESTCASE NUMBER: 3 -class Case3_1 : Interface1, InterfaceWithTypeParameter1, InterfaceWithTypeParameter2 -class Case3_2 : Interface1, InterfaceWithTypeParameter1, InterfaceWithTypeParameter2 +class Case3_1 : Interface3, InterfaceWithTypeParameter1, InterfaceWithTypeParameter2 +class Case3_2 : Interface3, InterfaceWithTypeParameter1, InterfaceWithTypeParameter2 fun case_3() { val x = select(Case3_1(), Case3_2(), null) if (x != null) { - & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>} & {Interface1? & InterfaceWithTypeParameter1 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>? & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>?}")!>x - & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>} & {Interface1? & InterfaceWithTypeParameter1 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>? & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>?}")!>x.ip1test1() - & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>} & {Interface1? & InterfaceWithTypeParameter1 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>? & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>?}")!>x.ip1test2() + & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>} & {Interface3? & InterfaceWithTypeParameter1 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>? & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>?}")!>x + & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>} & {Interface3? & InterfaceWithTypeParameter1 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>? & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>?}")!>x.ip1test1() + & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>} & {Interface3? & InterfaceWithTypeParameter1 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>? & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2}>}>}>}>?}")!>x.ip1test2() } } @@ -153,7 +155,15 @@ fun case_8() { val z = & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}> & ClassWithTwoTypeParameters & java.io.Serializable}, out {Comparable<{Char & Float}> & java.io.Serializable}>?")!>y.test2() if (z != null) { & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z - & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z.equals(z) + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z.equals(null) + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z.propT + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z.propAny + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z.propNullableT + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z.propNullableAny + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z.funT() + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?"), DEBUG_INFO_SMARTCAST!>z.funAny() + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z.funNullableT() + & java.io.Serializable} & {Comparable<{Int & String}> & java.io.Serializable}?")!>z.funNullableAny() } } } @@ -175,21 +185,37 @@ fun case_9() { val z = , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>>?")!>y.test2() if (z != null) { , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z - , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.equals(z) + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.equals(null) + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.propT + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.propAny + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.propNullableT + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.propNullableAny + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.funT() + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.funAny() + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.funNullableT() + , out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>> & ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>, out ClassWithTwoTypeParameters, out ClassWithTwoTypeParameters<*, *>>>>>?")!>z.funNullableAny() } } } } // TESTCASE NUMBER: 10 -open class Case10_1 : Interface1, InterfaceWithOutParameter -open class Case10_2 : Interface1, InterfaceWithOutParameter +open class Case10_1 : Interface3, InterfaceWithOutParameter +open class Case10_2 : Interface3, InterfaceWithOutParameter fun case_10() = run { val x = select(object : Case10_1() {}, object : Case10_2() {}, null) if (x != null) { - }>}>}>}>} & {Interface1? & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter}>}>}>}>?}")!>x - }>}>}>}>} & {Interface1? & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter<{Interface1 & InterfaceWithOutParameter}>}>}>}>?}"), DEBUG_INFO_SMARTCAST!>x.equals(x) + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}")!>x + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}"), DEBUG_INFO_SMARTCAST!>x.equals(null) + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}"), DEBUG_INFO_SMARTCAST!>x.propT + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}"), DEBUG_INFO_SMARTCAST!>x.propAny + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}")!>x.propNullableT + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}")!>x.propNullableAny + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}"), DEBUG_INFO_SMARTCAST!>x.funT() + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}"), DEBUG_INFO_SMARTCAST!>x.funAny() + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}")!>x.funNullableT() + }>}>}>}>} & {Interface3? & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter<{Interface3 & InterfaceWithOutParameter}>}>}>}>?}")!>x.funNullableAny() } } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.kt new file mode 100644 index 00000000000..6d9ef8ee488 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.kt @@ -0,0 +1,734 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION, -NAME_SHADOWING, -UNUSED_VARIABLE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 16 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, properties, classes, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Int?) { + if (x == null) return + x + x.inv() +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Unit?) { + if (x === null) return + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Nothing?) { + if (x != null) else return + x + x.hashCode() +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Number?) { + if (x !== null) else { return } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Char?, y: Nothing?) { + if (x != y) else return + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Object?) { + if (x !== implicitNullableNothingProperty) else { return } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Class?) { + if (x === implicitNullableNothingProperty || false || false || false) { return } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Int?) { + if (false || false || false || x == nullableNothingProperty) return + x + x.inv() +} + +// TESTCASE NUMBER: 9 +fun case_9(x: String?) { + if (x != implicitNullableNothingProperty && true && true && true) else { return } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Float?) { + if (true && true && true && x !== null) else return + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Out<*>?) { + if (x == null) return + & Out<*>?")!>x + & Out<*>?")!>x.equals(null) + & Out<*>?")!>x.propT + & Out<*>?")!>x.propAny + & Out<*>?")!>x.propNullableT + & Out<*>?")!>x.propNullableAny + & Out<*>?")!>x.funT() + & Out<*>?")!>x.funAny() + & Out<*>?")!>x.funNullableT() + & Out<*>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Map?) { + if (x === null) return + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.propT + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.funT() + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 13 +fun case_13(x: Map?) { + if (x != null) else return + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 14 +fun case_14(x: MutableCollection?) { + if (x !== null) else { return } + & kotlin.collections.MutableCollection?")!>x + & kotlin.collections.MutableCollection?")!>x.equals(null) + & kotlin.collections.MutableCollection?")!>x.propT + & kotlin.collections.MutableCollection?")!>x.propAny + & kotlin.collections.MutableCollection?")!>x.propNullableT + & kotlin.collections.MutableCollection?")!>x.propNullableAny + & kotlin.collections.MutableCollection?")!>x.funT() + & kotlin.collections.MutableCollection?")!>x.funAny() + & kotlin.collections.MutableCollection?")!>x.funNullableT() + & kotlin.collections.MutableCollection?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 15 +fun case_15(x: MutableCollection?, y: Nothing?) { + if (x != y) else return + & kotlin.collections.MutableCollection?")!>x + & kotlin.collections.MutableCollection?")!>x.equals(null) + & kotlin.collections.MutableCollection?")!>x.propT + & kotlin.collections.MutableCollection?")!>x.propAny + & kotlin.collections.MutableCollection?")!>x.propNullableT + & kotlin.collections.MutableCollection?")!>x.propNullableAny + & kotlin.collections.MutableCollection?")!>x.funT() + & kotlin.collections.MutableCollection?")!>x.funAny() + & kotlin.collections.MutableCollection?")!>x.funNullableT() + & kotlin.collections.MutableCollection?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 16 +fun case_16(x: Collection>>>>>>?) { + if (x !== implicitNullableNothingProperty) else { return } + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.propT + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.propAny + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.propNullableT + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.propNullableAny + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.funT() + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.funAny() + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.funNullableT() + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 17 +fun case_17(x: MutableMap<*, *>?) { + if (x === implicitNullableNothingProperty || false) { return } + & kotlin.collections.MutableMap<*, *>?")!>x + & kotlin.collections.MutableMap<*, *>?")!>x.equals(null) + & kotlin.collections.MutableMap<*, *>?")!>x.propT + & kotlin.collections.MutableMap<*, *>?")!>x.propAny + & kotlin.collections.MutableMap<*, *>?")!>x.propNullableT + & kotlin.collections.MutableMap<*, *>?")!>x.propNullableAny + & kotlin.collections.MutableMap<*, *>?")!>x.funT() + & kotlin.collections.MutableMap<*, *>?")!>x.funAny() + & kotlin.collections.MutableMap<*, *>?")!>x.funNullableT() + & kotlin.collections.MutableMap<*, *>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 18 +fun case_18(x: MutableMap?) { + if (false || false || false || x == nullableNothingProperty) return + & kotlin.collections.MutableMap?")!>x + & kotlin.collections.MutableMap?")!>x.equals(null) + & kotlin.collections.MutableMap?")!>x.propT + & kotlin.collections.MutableMap?")!>x.propAny + & kotlin.collections.MutableMap?")!>x.propNullableT + & kotlin.collections.MutableMap?")!>x.propNullableAny + & kotlin.collections.MutableMap?")!>x.funT() + & kotlin.collections.MutableMap?")!>x.funAny() + & kotlin.collections.MutableMap?")!>x.funNullableT() + & kotlin.collections.MutableMap?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 19 +fun case_19(x: Inv>>>>>>?) { + if (x === implicitNullableNothingProperty && true) else { return } + >>>>>>? & kotlin.Nothing?")!>x + >>>>>>? & kotlin.Nothing?")!>x.hashCode() +} + +// TESTCASE NUMBER: 20 +fun case_20(x: Inv>>>>>>?) { + if (true && true && true && x !== null) else return + >>>>>> & Inv>>>>>>?")!>x + >>>>>> & Inv>>>>>>?")!>x.equals(null) + >>>>>> & Inv>>>>>>?")!>x.propT + >>>>>> & Inv>>>>>>?")!>x.propAny + >>>>>> & Inv>>>>>>?")!>x.propNullableT + >>>>>> & Inv>>>>>>?")!>x.propNullableAny + >>>>>> & Inv>>>>>>?")!>x.funT() + >>>>>> & Inv>>>>>>?")!>x.funAny() + >>>>>> & Inv>>>>>>?")!>x.funNullableT() + >>>>>> & Inv>>>>>>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 21 +fun case_21(x: T) { + if (x == null) return + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 22 +fun case_22(x: T?) { + if (x === null) return + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 23 +fun case_23(x: Inv?) { + if (x !== null) else return + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 24 +fun case_24(x: Inv?, y: Nothing?) { + if (x !== y && true) else return + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 25 +fun case_25(x: Int?) { + val x = (l@ { + if (x == null) return@l + x + x.inv() + })() +} + +// TESTCASE NUMBER: 26 +fun case_26(x: Unit?, y: List<*>) { + y.forEach l@ { + if (x === null) return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 27 +fun case_27(x: Nothing?) = (l@ { + if (x != null) else return@l + x + x.hashCode() +})() + +// TESTCASE NUMBER: 28 +fun case_28(x: Number?) { + {(l@ { + if (x !== null) else { return@l } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + })()}() +} + +// TESTCASE NUMBER: 29 +fun case_29(x: Char?, y: Nothing?) = l@ { + if (x != y) else return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 30 +fun case_30(x: Object?): Any { + return (l@ { + if (x !== implicitNullableNothingProperty) else { return@l } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + })() +} + +// TESTCASE NUMBER: 31 +fun case_31(x: Class?): Any { + return l@ { + if (x === implicitNullableNothingProperty || false || false || false) { return@l } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 32 +fun case_32(x: Any?) { + case_32((l@ { + if (false || false || false || x == nullableNothingProperty) return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + })()) +} + +// TESTCASE NUMBER: 33 +fun case_33(x: Any?) { + case_33(l@ { + if (x != implicitNullableNothingProperty && true && true && true) else { return@l } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + }) +} + +// TESTCASE NUMBER: 34 +fun case_34(x: Float?) { + (l@ { + if (true && true && true && x !== null) else return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + }).equals(l@ { + if (true && true && true && x !== null) else return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + }) +} + +// TESTCASE NUMBER: 35 +fun case_35(x: Any?) { + case_35 l@ { + if (x == null) return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 36 +fun case_36(x: Any?) { + case_36 l@ { + if (x === null) return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 37 +fun case_37(x: Any?): Any? = case_37 l@ { + if (x === null) return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 38 +fun case_39(x: MutableCollection?) { + (l1@ { + (l2@ { + if (x !== null) else { + return@l2 + } + & kotlin.collections.MutableCollection?")!>x + & kotlin.collections.MutableCollection?")!>x.equals(null) + & kotlin.collections.MutableCollection?")!>x.propT + & kotlin.collections.MutableCollection?")!>x.propAny + & kotlin.collections.MutableCollection?")!>x.propNullableT + & kotlin.collections.MutableCollection?")!>x.propNullableAny + & kotlin.collections.MutableCollection?")!>x.funT() + & kotlin.collections.MutableCollection?")!>x.funAny() + & kotlin.collections.MutableCollection?")!>x.funNullableT() + & kotlin.collections.MutableCollection?")!>x.funNullableAny() + })() + })() +} + +// TESTCASE NUMBER: 39 +fun case_39(x: MutableCollection?, y: Nothing?) { + (l2@ { + if (x != y) else return@l2 + & kotlin.collections.MutableCollection?")!>x + & kotlin.collections.MutableCollection?")!>x.equals(null) + & kotlin.collections.MutableCollection?")!>x.propT + & kotlin.collections.MutableCollection?")!>x.propAny + & kotlin.collections.MutableCollection?")!>x.propNullableT + & kotlin.collections.MutableCollection?")!>x.propNullableAny + & kotlin.collections.MutableCollection?")!>x.funT() + & kotlin.collections.MutableCollection?")!>x.funAny() + & kotlin.collections.MutableCollection?")!>x.funNullableT() + & kotlin.collections.MutableCollection?")!>x.funNullableAny() + })() +} + +// TESTCASE NUMBER: 40 +fun case_40(x: Collection>>>>>>?) { + val z = (l@ { + if (x !== implicitNullableNothingProperty) else { return@l } + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.propT + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.propAny + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.propNullableT + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.propNullableAny + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.funT() + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.funAny() + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.funNullableT() + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.funNullableAny() + })() +} + +// TESTCASE NUMBER: 41 +fun case_41(x: MutableMap<*, *>?) { + listOf(l@ { + if (x === implicitNullableNothingProperty || false) { return@l } + & kotlin.collections.MutableMap<*, *>?")!>x + & kotlin.collections.MutableMap<*, *>?")!>x.equals(null) + & kotlin.collections.MutableMap<*, *>?")!>x.propT + & kotlin.collections.MutableMap<*, *>?")!>x.propAny + & kotlin.collections.MutableMap<*, *>?")!>x.propNullableT + & kotlin.collections.MutableMap<*, *>?")!>x.propNullableAny + & kotlin.collections.MutableMap<*, *>?")!>x.funT() + & kotlin.collections.MutableMap<*, *>?")!>x.funAny() + & kotlin.collections.MutableMap<*, *>?")!>x.funNullableT() + & kotlin.collections.MutableMap<*, *>?")!>x.funNullableAny() + }) +} + +// TESTCASE NUMBER: 42 +fun case_42(x: MutableMap?) { + return (l@ { + if (false || false || false || x == nullableNothingProperty) return@l + & kotlin.collections.MutableMap?")!>x + & kotlin.collections.MutableMap?")!>x.equals(null) + & kotlin.collections.MutableMap?")!>x.propT + & kotlin.collections.MutableMap?")!>x.propAny + & kotlin.collections.MutableMap?")!>x.propNullableT + & kotlin.collections.MutableMap?")!>x.propNullableAny + & kotlin.collections.MutableMap?")!>x.funT() + & kotlin.collections.MutableMap?")!>x.funAny() + & kotlin.collections.MutableMap?")!>x.funNullableT() + & kotlin.collections.MutableMap?")!>x.funNullableAny() + })() +} + +// TESTCASE NUMBER: 43 +fun case_43(x: Inv>>>>>>?): Any? { + return l@ { + if (x === implicitNullableNothingProperty && true) else { return@l } + >>>>>>? & kotlin.Nothing?")!>x + >>>>>>? & kotlin.Nothing?")!>x.hashCode() + } +} + +// TESTCASE NUMBER: 44 +fun case_44(x: Inv>>>>>>?) { + (l@ { + if (true && true && true && x !== null) else return@l + >>>>>> & Inv>>>>>>?")!>x + >>>>>> & Inv>>>>>>?")!>x.equals(null) + >>>>>> & Inv>>>>>>?")!>x.propT + >>>>>> & Inv>>>>>>?")!>x.propAny + >>>>>> & Inv>>>>>>?")!>x.propNullableT + >>>>>> & Inv>>>>>>?")!>x.propNullableAny + >>>>>> & Inv>>>>>>?")!>x.funT() + >>>>>> & Inv>>>>>>?")!>x.funAny() + >>>>>> & Inv>>>>>>?")!>x.funNullableT() + >>>>>> & Inv>>>>>>?")!>x.funNullableAny() + }).invoke() +} + +// TESTCASE NUMBER: 45 +fun case_45(x: T) { + val y = (l@ { + if (x == null) return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + })() +} + +// TESTCASE NUMBER: 46 +fun case_46(x: T?) { + (l@ { + if (x === null) return@l + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + })() +} + +// TESTCASE NUMBER: 47 +fun case_47(x: Inv?) { + val y = l@ { + if (x !== null) else return@l + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 48 +fun case_48(x: Inv?, y: Nothing?) { + val y = ((((l@ { + if (x !== y && true) else return@l + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + })))) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.kt new file mode 100644 index 00000000000..3ce2fab8a8e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.kt @@ -0,0 +1,354 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 17 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, properties, classes, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Int?) { + if (x == null) throw Exception() + x + x.inv() +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Unit?) { + if (x === null) throw Exception() + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Nothing?) { + if (x != null) else throw Exception() + x +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Number?) { + if (x !== null) else { throw Exception() } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Char?, y: Nothing?) { + if (x != y) else throw Exception() + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Object?) { + if (x !== implicitNullableNothingProperty) else { throw Exception() } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Class?) { + if (x === implicitNullableNothingProperty || false || false || false) { throw Exception() } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Int?) { + if (false || false || false || x == nullableNothingProperty) throw Exception() + x + x.inv() +} + +// TESTCASE NUMBER: 9 +fun case_9(x: String?) { + if (x != implicitNullableNothingProperty && true && true && true) else { throw Exception() } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Float?) { + if (true && true && true && x !== null) else throw Exception() + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Out<*>?) { + if (x == null) throw Exception() + & Out<*>?")!>x + & Out<*>?")!>x.equals(null) + & Out<*>?")!>x.propT + & Out<*>?")!>x.propAny + & Out<*>?")!>x.propNullableT + & Out<*>?")!>x.propNullableAny + & Out<*>?")!>x.funT() + & Out<*>?")!>x.funAny() + & Out<*>?")!>x.funNullableT() + & Out<*>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Map?) { + if (x === null) throw Exception() + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.propT + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.funT() + & kotlin.collections.Map?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 13 +fun case_13(x: Map?) { + if (x != null) else throw Exception() + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 14 +fun case_14(x: MutableCollection?) { + if (x !== null) else { throw Exception() } + & kotlin.collections.MutableCollection?")!>x + & kotlin.collections.MutableCollection?")!>x.equals(null) + & kotlin.collections.MutableCollection?")!>x.propT + & kotlin.collections.MutableCollection?")!>x.propAny + & kotlin.collections.MutableCollection?")!>x.propNullableT + & kotlin.collections.MutableCollection?")!>x.propNullableAny + & kotlin.collections.MutableCollection?")!>x.funT() + & kotlin.collections.MutableCollection?")!>x.funAny() + & kotlin.collections.MutableCollection?")!>x.funNullableT() + & kotlin.collections.MutableCollection?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 15 +fun case_15(x: MutableCollection?, y: Nothing?) { + if (x != y) else throw Exception() + & kotlin.collections.MutableCollection?")!>x + & kotlin.collections.MutableCollection?")!>x.equals(null) + & kotlin.collections.MutableCollection?")!>x.propT + & kotlin.collections.MutableCollection?")!>x.propAny + & kotlin.collections.MutableCollection?")!>x.propNullableT + & kotlin.collections.MutableCollection?")!>x.propNullableAny + & kotlin.collections.MutableCollection?")!>x.funT() + & kotlin.collections.MutableCollection?")!>x.funAny() + & kotlin.collections.MutableCollection?")!>x.funNullableT() + & kotlin.collections.MutableCollection?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 16 +fun case_16(x: Collection>>>>>>?) { + if (x !== implicitNullableNothingProperty) else { throw Exception() } + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.propT + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.propAny + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.propNullableT + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.propNullableAny + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.funT() + >>>>>> & kotlin.collections.Collection>>>>>>?"), DEBUG_INFO_SMARTCAST!>x.funAny() + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.funNullableT() + >>>>>> & kotlin.collections.Collection>>>>>>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 17 +fun case_17(x: MutableMap<*, *>?) { + if (x === implicitNullableNothingProperty || false) { throw Exception() } + & kotlin.collections.MutableMap<*, *>?")!>x + & kotlin.collections.MutableMap<*, *>?")!>x.equals(null) + & kotlin.collections.MutableMap<*, *>?")!>x.propT + & kotlin.collections.MutableMap<*, *>?")!>x.propAny + & kotlin.collections.MutableMap<*, *>?")!>x.propNullableT + & kotlin.collections.MutableMap<*, *>?")!>x.propNullableAny + & kotlin.collections.MutableMap<*, *>?")!>x.funT() + & kotlin.collections.MutableMap<*, *>?")!>x.funAny() + & kotlin.collections.MutableMap<*, *>?")!>x.funNullableT() + & kotlin.collections.MutableMap<*, *>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 18 +fun case_18(x: MutableMap?) { + if (false || false || false || x == nullableNothingProperty) throw Exception() + & kotlin.collections.MutableMap?")!>x + & kotlin.collections.MutableMap?")!>x.equals(null) + & kotlin.collections.MutableMap?")!>x.propT + & kotlin.collections.MutableMap?")!>x.propAny + & kotlin.collections.MutableMap?")!>x.propNullableT + & kotlin.collections.MutableMap?")!>x.propNullableAny + & kotlin.collections.MutableMap?")!>x.funT() + & kotlin.collections.MutableMap?")!>x.funAny() + & kotlin.collections.MutableMap?")!>x.funNullableT() + & kotlin.collections.MutableMap?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 19 +fun case_19(x: Inv>>>>>>?) { + if (x === implicitNullableNothingProperty && true) else { throw Exception() } + >>>>>>? & kotlin.Nothing?")!>x + >>>>>>? & kotlin.Nothing?")!>x.hashCode() +} + +// TESTCASE NUMBER: 20 +fun case_20(x: Inv>>>>>>?) { + if (true && true && true && x !== null) else throw Exception() + >>>>>> & Inv>>>>>>?")!>x + >>>>>> & Inv>>>>>>?")!>x.equals(null) + >>>>>> & Inv>>>>>>?")!>x.propT + >>>>>> & Inv>>>>>>?")!>x.propAny + >>>>>> & Inv>>>>>>?")!>x.propNullableT + >>>>>> & Inv>>>>>>?")!>x.propNullableAny + >>>>>> & Inv>>>>>>?")!>x.funT() + >>>>>> & Inv>>>>>>?")!>x.funAny() + >>>>>> & Inv>>>>>>?")!>x.funNullableT() + >>>>>> & Inv>>>>>>?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 21 +fun case_21(x: T) { + if (x == null) throw Exception() + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 22 +fun case_22(x: T?) { + if (x === null) throw Exception() + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() +} + +// TESTCASE NUMBER: 23 +fun case_23(x: Inv?) { + if (x !== null) else throw Exception() + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 24 +fun case_24(x: Inv?, y: Nothing?) { + if (x !== y && true) else throw Exception() + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 25 +fun case_25(x: Inv?, y: Nothing?) { + if (x !== y) else try { throw Exception() } finally { throw Exception() } + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.kt new file mode 100644 index 00000000000..936b9c2e2b6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.kt @@ -0,0 +1,420 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 18 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, properties, classes, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Int?) { + while (true) { + if (x == null) break + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Unit?) { + while (true) { + if (x === null) continue + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Nothing?, f: Boolean) { + do { + if (x != null) else break + x.hashCode() + } while (f) +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Number?) { + for (i in 0..10) { + if (x !== null) else { break } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Char?, y: Nothing?, f: Boolean) { + do { + if (x != y) else continue + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } while (f) +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Object?, f: Boolean) { + while (f) { + if (x !== implicitNullableNothingProperty) else { continue } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Class?, list: List) { + for (element in list) { + if (x === implicitNullableNothingProperty || false || false || false) { break } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Int?) { + for (i in 0..10) { + if (false || false || false || x == nullableNothingProperty) continue + x + x.inv() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(list: List) { + for (element in list) { + if (element != implicitNullableNothingProperty && true && true && true) else { break } + element + element.inv() + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Float?) { + while (false) { + if (true && true && true && x !== null) else break + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Out<*>?, list: List) { + for (element in list) { + if (x == null) continue + & Out<*>?")!>x + & Out<*>?")!>x.equals(null) + & Out<*>?")!>x.propT + & Out<*>?")!>x.propAny + & Out<*>?")!>x.propNullableT + & Out<*>?")!>x.propNullableAny + & Out<*>?")!>x.funT() + & Out<*>?")!>x.funAny() + & Out<*>?")!>x.funNullableT() + & Out<*>?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 12 +fun case_12(list: List) { + for (element in list) { + if (element === null) continue + element + element.inv() + } +} + +// TESTCASE NUMBER: 13 +fun case_13(x: Map?) { + do { + if (x != null) else continue + & kotlin.collections.Map?")!>x + & kotlin.collections.Map?")!>x.equals(null) + & kotlin.collections.Map?")!>x.propT + & kotlin.collections.Map?")!>x.propAny + & kotlin.collections.Map?")!>x.propNullableT + & kotlin.collections.Map?")!>x.propNullableAny + & kotlin.collections.Map?")!>x.funT() + & kotlin.collections.Map?")!>x.funAny() + & kotlin.collections.Map?")!>x.funNullableT() + & kotlin.collections.Map?")!>x.funNullableAny() + } while (false) +} + +// TESTCASE NUMBER: 14 +fun case_14(x: MutableCollection?, r: IntRange) { + for (i in r) { + if (x !== null) else { break } + & kotlin.collections.MutableCollection?")!>x + & kotlin.collections.MutableCollection?")!>x.equals(null) + & kotlin.collections.MutableCollection?")!>x.propT + & kotlin.collections.MutableCollection?")!>x.propAny + & kotlin.collections.MutableCollection?")!>x.propNullableT + & kotlin.collections.MutableCollection?")!>x.propNullableAny + & kotlin.collections.MutableCollection?")!>x.funT() + & kotlin.collections.MutableCollection?")!>x.funAny() + & kotlin.collections.MutableCollection?")!>x.funNullableT() + & kotlin.collections.MutableCollection?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 15 +fun case_15(map: MutableMap, y: Nothing?) { + for ((k, v) in map) { + if (k != y) else break + if (v != y) else continue + k + k.inv() + v + v.inv() + } +} + +// TESTCASE NUMBER: 16 +fun case_16(map: Map) { + for ((k, v) in map) { + if (k !== implicitNullableNothingProperty && v !== implicitNullableNothingProperty) else { continue } + k + k.inv() + v + v.inv() + } +} + +// TESTCASE NUMBER: 17 +fun case_17(x: T?, f: Boolean) { + while (f) { + if (x === implicitNullableNothingProperty || false) { break } + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 18 +fun case_18(x: T, f: Boolean) { + while (f) { + if (false || false || false || x == nullableNothingProperty) break + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 19 +fun case_19(map: MutableMap, y: Nothing?) { + for ((k, v) in map) { + if (k !== implicitNullableNothingProperty && true && v != y) else { break } + k + k.equals(null) + k.propT + k.propAny + k.propNullableT + k.propNullableAny + k.funT() + k.funAny() + k.funNullableT() + k.funNullableAny() + v + v.equals(null) + v.propT + v.propAny + v.propNullableT + v.propNullableAny + v.funT() + v.funAny() + v.funNullableT() + v.funNullableAny() + } +} + +// TESTCASE NUMBER: 20 +fun case_20(map: MutableMap) { + for ((k, v) in map) { + if (true && true && true && k !== null && v != null && true) else continue + k + k.equals(null) + k.propT + k.propAny + k.propNullableT + k.propNullableAny + k.funT() + k.funAny() + k.funNullableT() + k.funNullableAny() + v + v.equals(null) + v.propT + v.propAny + v.propNullableT + v.propNullableAny + v.funT() + v.funAny() + v.funNullableT() + v.funNullableAny() + } +} + +// TESTCASE NUMBER: 21 +fun case_21(map: MutableMap) { + for ((k, v) in map) { + if (k == null) continue + if (v === null || false) break + k + k.equals(null) + k.propT + k.propAny + k.propNullableT + k.propNullableAny + k.funT() + k.funAny() + k.funNullableT() + k.funNullableAny() + v + v.equals(null) + v.propT + v.propAny + v.propNullableT + v.propNullableAny + v.funT() + v.funAny() + v.funNullableT() + v.funNullableAny() + } +} + +// TESTCASE NUMBER: 22 +fun case_22(x: T?) { + while (true) { + if (x === null) break + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 23 +fun case_23(x: Inv?) { + for (i in -10..10) { + if (x !== null) else continue + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 24 +fun case_24(x: Inv?, y: Nothing?) { + do { + if (x !== y && true) else continue + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } while (true) +} + +// TESTCASE NUMBER: 25 +fun case_25(x: Inv?, y: Nothing?, z: List) { + for (i in z) { + if (x !== y) else try { + break + } finally { + continue + } + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt new file mode 100644 index 00000000000..ed0d41744c1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt @@ -0,0 +1,102 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 19 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Int) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any) { + if (x is Unit) { + x + x.toString() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x !is Class) else { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any) { + if (x !is EnumClass) else { + x + x.fun_1() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (!(x !is Class.NestedClass?)) { + x + x?.prop_4 + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (!(x !is Object)) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any) { + if (!(x is DeepObject.A.B.C.D.E.F.G.J)) else { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (!(x is Int?)) else { + x + x?.inv() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (!!(x !is TypealiasNullableStringIndirect?)) else { + x + x?.get(0) + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + if (!!(x !is Interface3)) else { + x + x.itest() + x.itest3() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + if (x is SealedMixedChildObject1?) { + x + x?.prop_1 + x?.prop_2 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.kt new file mode 100644 index 00000000000..90ebb9e6e15 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.kt @@ -0,0 +1,506 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 2 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, enumClasses, properties, functions + */ + +// FILE: other_package.kt + +package otherpackage + +// TESTCASE NUMBER: 8, 16 +class Case8_16__1 {} + +// FILE: main.kt + +import otherpackage.* + +// TESTCASE NUMBER: 8, 16 +class Case8_16__2 { + val x: otherpackage.Case8_16__1? + init { + x = otherpackage.Case8_16__1() + } +} + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x != null || false) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(a: DeepObject.A.B.C.D.E.F.G.J?) = + if (false || a != null == true == false == false == false == true == false == true == false == false == true == true || false) { + a.x + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } else -1 + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28328 + */ +fun case_3(b: Boolean) { + val x = { + if (b) object { + val a = 10 + } else null + } + + val y = if (b) x else null + + if (false || false || false || false || y !== null) { + val z = .?")!>y() + case_3..?)?")!>y.equals(null) + case_3..?)?")!>y.propT + case_3..?)?")!>y.propAny + case_3..?)?")!>y.propNullableT + case_3..?)?")!>y.propNullableAny + case_3..?)?")!>y.funT() + case_3..?)?")!>y.funAny() + case_3..?)?")!>y.funNullableT() + case_3..?)?")!>y.funNullableAny() + + if (z != null || false) { + . & case_3..?"), DEBUG_INFO_SMARTCAST!>z.a + } + } +} + +// TESTCASE NUMBER: 4 +fun case_4(a: ((Float) -> Int?)?, b: Float?) { + if (a != null == true && b != null == true || false || false || false || false || false || false || false || false || false) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.equals(null) + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.propT + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.propAny + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.propNullableT + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.propNullableAny + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.funT() + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.funAny() + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.funNullableT() + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.funNullableAny() + + if (false || x != null == true) { + x + } + } +} + +// TESTCASE NUMBER: 5 +fun case_5(b: Boolean) { + val a = if (b) { + object { + val B5 = if (b) { + object { + val C5 = if (b) { + object { + val D5 = if (b) { + object { + val x: Number? = 10 + } + } else null + } + } else null + } + } else null + } + } else null + + if (a != null && a.B5 != null && a.B5.C5 != null && a.B5.C5.D5 != null && a.B5.C5.D5.x != null && b || false) { + a.B5.C5.D5.x + a.B5.C5.D5.x.equals(null) + a.B5.C5.D5.x.propT + a.B5.C5.D5.x.propAny + a.B5.C5.D5.x.propNullableT + a.B5.C5.D5.x.propNullableAny + a.B5.C5.D5.x.funT() + a.B5.C5.D5.x.funAny() + a.B5.C5.D5.x.funNullableT() + a.B5.C5.D5.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 6 +fun case_6(z: Boolean?) { + if (false || EnumClassWithNullableProperty.B.prop_1 != null && z != null && z) { + EnumClassWithNullableProperty.B.prop_1 + EnumClassWithNullableProperty.B.prop_1.equals(null) + EnumClassWithNullableProperty.B.prop_1.propT + EnumClassWithNullableProperty.B.prop_1.propAny + EnumClassWithNullableProperty.B.prop_1.propNullableT + EnumClassWithNullableProperty.B.prop_1.propNullableAny + EnumClassWithNullableProperty.B.prop_1.funT() + EnumClassWithNullableProperty.B.prop_1.funAny() + EnumClassWithNullableProperty.B.prop_1.funNullableT() + EnumClassWithNullableProperty.B.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(a: DeepObject.A.B.C.D.E.F.G.J?) { + val g = false + + if (a != null && g) { + a + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_8(b: Boolean, c: Boolean?) { + val a = Case8_16__2() + + if (a.x !== null && false) { + if (false || false || false || false || a.x != null || false || false || false) { + if (a.x !== null && true) { + if (a.x != null && b) { + if (a.x != null && b && !b) { + if (a.x != null && c != null && !c) { + if (a.x !== null && c) { + if (a.x != null && b && b && b && b && b && b && b && b && b && b && b) { + if (a.x != null && !b && !b && !b && !b && !b && !b && !b && !b && !b) { + if (a.x !== null && null == null) { + if (a.x != null && null!!) { + if (a.x != null) { + if (a.x != null) { + if (a.x !== null) { + if (a.x != null) { + if (a.x !== null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (x == null || false || false || false || false || false || false) { + + } else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 10 +fun case_10(a: DeepObject.A.B.C.D.E.F.G.J?) = + if (a == null == true == false == false == false == true == false == true == false == false == true == true && true) { + -1 + } else { + a.x + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28328 + */ +fun case_11(b: Boolean) { + val x = { + if (b) object { + val a = 10 + } else null + } + + val y = if (b) x else null + + if (y === null && true) else { + val z = .?")!>y() + case_11..?)?")!>y.equals(null) + case_11..?)?")!>y.propT + case_11..?)?")!>y.propAny + case_11..?)?")!>y.propNullableT + case_11..?)?")!>y.propNullableAny + case_11..?)?")!>y.funT() + case_11..?)?")!>y.funAny() + case_11..?)?")!>y.funNullableT() + case_11..?)?")!>y.funNullableAny() + + if (z != null || b) { + + } else { + .? & kotlin.Nothing?")!>z + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { + if (true && a == null == true || b == null == true) { + + } else { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.equals(null) + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.propT + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.propAny + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.propNullableT + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.propNullableAny + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.funT() + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a.funAny() + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.funNullableT() + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?")!>a.funNullableAny() + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() + if (x == null == true || (c != null && !c)) { + + } else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 13 +fun case_13(b: Boolean, c: Boolean, d: Boolean) { + val a = if (b) { + object { + val B19 = if (b) { + object { + val C19 = if (b) { + object { + val D19 = if (b) { + object { + val x: Number? = 10 + } + } else null + } + } else null + } + } else null + } + } else null + + if ((a == null || a.B19 == null || a.B19.C19 == null || a.B19.C19.D19 == null || a.B19.C19.D19.x == null || b || c || !d) && true) { + + } else { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_14(z: Boolean?) { + if (true && true && true && true && EnumClassWithNullableProperty.B.prop_1 != null || z != null || z!! && true && true) { + + } else { + EnumClassWithNullableProperty.B.prop_1 + EnumClassWithNullableProperty.B.prop_1.equals(null) + EnumClassWithNullableProperty.B.prop_1.propT + EnumClassWithNullableProperty.B.prop_1.propAny + EnumClassWithNullableProperty.B.prop_1.propNullableT + EnumClassWithNullableProperty.B.prop_1.propNullableAny + EnumClassWithNullableProperty.B.prop_1.funT() + EnumClassWithNullableProperty.B.prop_1.funAny() + EnumClassWithNullableProperty.B.prop_1.funNullableT() + EnumClassWithNullableProperty.B.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 15 +fun case_15(a: DeepObject.A.B.C.D.E.F.G.J?) { + val g = false + + if (true && a != null || g || !g || true || !true) { + + } else { + a + } +} + +// TESTCASE NUMBER: 16 +fun case_16(b: Boolean, c: Boolean?) { + val a = Case8_16__2() + + if (a.x != null && false && false && false && false && false && false) { + if ( a.x == null || false) { + } else { + if ( a.x === null && true) { + } else { + if (a.x == null || !b) { + } else { + if (a.x == null || b || !b) { + } else { + if (a.x == null || c == null || !c) { + } else { + if (a.x === null || c) { + } else { + if (a.x == null || b || b || b || b || b || b || b || b || b || b || b) { + } else { + if (a.x == null || !b || !b || !b || !b || !b || !b || !b || !b || !b) { + } else { + if (a.x === null || null == null) { + } else { + if (a.x == null || null!!) { + } else { + if (a.x == null) { + } else { + if (a.x == null) { + } else { + if (a.x === null) { + } else { + if (a.x == null) { + } else { + if (a.x === null) { + } else { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 17 +fun case_17(a: Int?, b: Int = if (a != null) a else 0) { + a + b + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() +} + +// TESTCASE NUMBER: 18 +fun case_18(a: Int?, b: Int = if (false || a != null || false) a else 0) { + a + b + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt new file mode 100644 index 00000000000..7759beeb3ea --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt @@ -0,0 +1,114 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 20 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Int || false) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any) { + if (x is Unit || false || false || false || false || false) { + x + x.toString() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (true && x !is Class) else { + x + x.prop_1 + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_4(x: Any) { + if (true && true && x !is EnumClass) else { + x + x.fun_1() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (false || !(x !is Class.NestedClass?)) { + x + x?.prop_4 + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_6(x: Any?) { + if (false || false || !(x !is Object)) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any) { + if (!(x is DeepObject.A.B.C.D.E.F.G.J) && true && true && true) else { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (!(x is Int?) && true) else { + x + x?.inv() + } +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_9(x: Any?) { + if (true && true && !!(x !is TypealiasNullableStringIndirect?) && true && true && true && true) else { + x + x?.get(0) + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + if (true && !!(x !is Interface3) && true) else { + x + x.itest() + x.itest3() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + if (false || x is SealedMixedChildObject1? || false) { + x + x?.prop_1 + x?.prop_2 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt new file mode 100644 index 00000000000..dacd7086943 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt @@ -0,0 +1,122 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 21 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Int == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_2(x: Any) { + if (x is Int === true) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x !is Class == true == true == true == true == true) else { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any) { + if (x !is EnumClass != false) else { + x + x.fun_1() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (!(x !is Class.NestedClass?) != false == true) { + x + x?.prop_4 + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (!(x !is Object) != false != false != false) { + x + x.prop_1 + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_7(x: Any) { + if (!(x is DeepObject.A.B.C.D.E.F.G.J) !== false) else { + x + x.prop_1 + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_8(x: Any?) { + if (!(x is Int?) !== false !== false !== false) else { + x + x?.inv() + } +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_9(x: Any?) { + if (!!(x !is TypealiasNullableStringIndirect?) !== false === true) else { + x + x?.get(0) + } +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_10(x: Any?) { + if (!!(x !is Interface3) === true && true) else { + x + x.itest() + x.itest3() + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + if (x is SealedMixedChildObject1? != false || false) { + x + x?.prop_1 + x?.prop_2 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt new file mode 100644 index 00000000000..6c40bd3cb73 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt @@ -0,0 +1,160 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 22 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Int) { + if (x !is Int) { + x + x.inv() + } + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any) { + if (x !is Unit) { + if (x is Unit) { + x + x.toString() + } + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x !is Class) { + if (x !is Class) else { + x + x.prop_1 + } + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any) { + if (x !is EnumClass) else { + if (x !is EnumClass) { + x + x.fun_1() + } + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (!(x !is Class.NestedClass?)) { + if (!!(x !is Class.NestedClass?)) { + x + x?.prop_4 + } + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (!(x is Object)) { + if (!(x !is Object)) { + x + x.prop_1 + } + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any) { + if (!(x is DeepObject.A.B.C.D.E.F.G.J)) { + if (!(x is DeepObject.A.B.C.D.E.F.G.J)) else { + x + x.prop_1 + } + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (!!!!(x is Int?)) else { + if (!(x is Int?)) else { + x + x?.inv() + } + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (!!!(x !is TypealiasNullableStringIndirect?)) else { + if (!!(x !is TypealiasNullableStringIndirect?)) else { + x + x?.get(0) + } + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + if (!!(x is Interface3)) else { + if (!!(x !is Interface3)) else { + x + x.itest() + x.itest3() + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + if (x is SealedMixedChildObject1?) { + if (x is SealedMixedChildObject1?) { + x + x?.prop_1 + x?.prop_2 + } + } +} + +// TESTCASE NUMBER: 12 +inline fun case_12(x: Any?) { + if (x is T) { + if (x is T is K) { + x + } + } +} + +// TESTCASE NUMBER: 13 +inline fun case_13(x: Any?) { + if (x is T) { + if (x is K) { + x + } + } +} + +// TESTCASE NUMBER: 14 +inline fun case_14(x: Any?) { + if (x is T) { + if (x !is T) { + x + } + } +} + +// TESTCASE NUMBER: 15 +inline fun case_15(x: Any?) { + if (x !is T) { + if (x is T) { + x + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.kt new file mode 100644 index 00000000000..9572944672a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.kt @@ -0,0 +1,51 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 23 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +class Case1 { + inline fun case_1(x: Any?) { + if (x is T) { + x + x.length + x.get(0) + } + } +} + +// TESTCASE NUMBER: 2 +fun case_2() where T: CharSequence, T: Number { + class Case1 where K : T { + inline fun case_1(x: Any?) { + if (x is T) { + x + x.toByte() + x.length + x.get(0) + } + } + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) where T: CharSequence, T: Number { + class Case1 where K : T { + inline fun case_1() { + if (x is T) { + x + x.toByte() + x.length + x.get(0) + } + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.kt new file mode 100644 index 00000000000..5cd0a28212a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.kt @@ -0,0 +1,26 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 24 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) where T: CharSequence { + x as T + class Case1 where K : T { + inline fun case_1() { + if (x is T) { + x.toByte() + x.length + x.get(0) + } + } + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.kt new file mode 100644 index 00000000000..1d2bbad55ba --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.kt @@ -0,0 +1,75 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 25 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +open class Case1 { + open inner class Case1_1: Case1() where L : CharSequence { + inner class Case1_2: Case1.Case1_1() where M : Map { + inline fun case_1(x: Any?) { + x as M + x as L + x as K + if (x is T) { + x + x.toByte() + x.length + x.get(0) + x.size + x.isEmpty() + x[null] + } + } + } + } +} + +// TESTCASE NUMBER: 2 +inline fun case_2(x: Any?) { + x as T + if (x !is T) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 3 +inline fun case_3(x: Any?) { + x as T? + if (x is T) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 4 +inline fun case_4(x: Any?) { + (x as? T)!! + if (x is T?) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 5 +inline fun case_5(x: Any?) { + if (x as? T != null) { + if (x is T?) { + x + x.length + x.get(0) + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.kt new file mode 100644 index 00000000000..5e500da4ff9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.kt @@ -0,0 +1,75 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 26 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +open class Case1 { + open inner class Case1_1: Case1() where L : CharSequence { + inner class Case1_2: Case1.Case1_1() where M : Map { + inline fun case_1(x: Any?) { + x as M + x as L + x as K + if (x is T) { + x + x.toByte() + x.length + x.get(0) + x.size + x.isEmpty() + x[null] + } + } + } + } +} + +// TESTCASE NUMBER: 2 +inline fun case_2(x: Any?) { + x as T + if (x !is T) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 3 +inline fun case_3(x: Any?) { + x as T? + if (x is T) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 4 +inline fun case_4(x: Any?) { + (x as? T)!! + if (x is T?) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 5 +inline fun case_5(x: Any?) { + if (x as? T != null) { + if (x is T?) { + x + x.length + x.get(0) + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.kt new file mode 100644 index 00000000000..6e0edcc9659 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.kt @@ -0,0 +1,75 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 27 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +open class Case1 { + open inner class Case1_1: Case1() where L : CharSequence { + inner class Case1_2: Case1.Case1_1() where M : Map { + inline fun case_1(x: Any?) { + x as M + x as L + x as K + if (x is T) { + x + x.toByte() + x.length + x.get(0) + x.size + x.isEmpty() + x[null] + } + } + } + } +} + +// TESTCASE NUMBER: 2 +inline fun case_2(x: Any?) { + x as T + if (x !is T) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 3 +inline fun case_3(x: Any?) { + x as T? + if (x is T) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 4 +inline fun case_4(x: Any?) { + (x as? T)!! + if (x is T?) { + x + x.length + x.get(0) + } +} + +// TESTCASE NUMBER: 5 +inline fun case_5(x: Any?) { + if (x as? T != null) { + if (x is T?) { + x + x.length + x.get(0) + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.kt new file mode 100644 index 00000000000..f6701c4ac3c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.kt @@ -0,0 +1,358 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 28 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Int?) { + if (x?.inv() != null) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Int?) { + if (x?.inv() == null) else if (true) {} else { + x + x.inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Boolean?) { + if (x?.not() == null) else { + x + x.not() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: EnumClass?) { + if (x?.fun_1() !== null) { + x + x.fun_1() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Class.NestedClass?) { + if (x?.prop_4 != null) { + x + x.prop_4 + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Class.NestedClass?) { + if (!(x?.prop_4 == null)) { + x + x.prop_4 + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: DeepObject.A.B.C.D.E.F.G.J?) { + if (!!(x?.prop_1 != null)) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (x?.equals(10) === null) else { + x + x.equals(10) + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (x?.equals(10) !== null) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +fun case_10(x: Interface3?) { + if (x?.itest() == null == true) else { + x + x.itest() + x.itest3() + } +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +fun case_11(x: SealedMixedChildObject1?) { + if (x?.prop_1 != null == true) { + x + x.prop_1 + x.prop_2 + } +} + +// TESTCASE NUMBER: 12 +inline fun case_12(x: Any?) { + if (x?.equals(10) != null) { + x + x.equals(10) + } +} + +// TESTCASE NUMBER: 13 +inline fun case_13(x: Any?) { + if (x?.equals(10) == null) {} else { + x + x.equals(10) + } +} + +// TESTCASE NUMBER: 14 +inline fun case_14(x: Any?) { + if (x?.equals(10) === null) else { + x + x.equals(10) + } +} + +// TESTCASE NUMBER: 15 +inline fun case_15(x: Any?) { + if (x?.equals(10) !== null) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 16 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262 + */ +inline fun case_16(x: Any?) { + if (x?.equals(10) === null == true) else { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262 + */ +inline fun case_17(x: Any?) { + if (x?.equals(10) !== null == true) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 18 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262, KT-29878 + */ +inline fun case_18(x: Any?) { + if (x?.equals(10) === null === true) else { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 19 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262, KT-29878 + */ +inline fun case_19(x: Any?) { + if (x?.equals(10) !== null === true) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 20 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262, KT-29878 + */ +inline fun case_20(x: Any?) { + if (x?.equals(10) === null !== false) else { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 21 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262, KT-29878 + */ +inline fun case_21(x: Any?) { + if (x?.equals(10) !== null !== false) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 22 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262, KT-29878 + */ +inline fun case_22(x: Any?) { + if (x?.equals(10) !== null !== true) else { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 23 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262, KT-29878 + */ +inline fun case_23(x: Any?) { + if (x?.equals(10) === null === false) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 24 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262 + */ +inline fun case_24(x: Any?) { + if (x?.equals(10) !== null != true) else { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 25 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-28262 + */ +inline fun case_25(x: Any?) { + if (x?.equals(10) === null == false) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 26 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-29878 + */ +inline fun case_26(x: Any?) { + if (x?.equals(10) != null === false) else { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 27 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369, KT-29878 + */ +inline fun case_27(x: Any?) { + if (x?.equals(10) == null === false) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 28 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +inline fun case_28(x: Any?) { + if (x?.equals(10) != null == false) else { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 29 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +inline fun case_29(x: Any?) { + if (x?.equals(10) == null == false) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 30 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +fun case_30(x: Class.NestedClass?) { + if (x?.prop_4 != null == true) { + x + x.prop_4 + } +} + +/* + * TESTCASE NUMBER: 31 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +fun case_31(x: Class.NestedClass?) { + if (!(x?.prop_4 == null) != false) { + x + x.prop_4 + } +} + +/* + * TESTCASE NUMBER: 32 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +fun case_32(x: Class.NestedClass?) { + if (x?.prop_4 == null == false) { + x + x.prop_4 + } +} + +/* + * TESTCASE NUMBER: 33 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +fun case_33(x: Class.NestedClass?) { + if (!(x?.prop_4 != null) != true) { + x + x.prop_4 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.kt new file mode 100644 index 00000000000..135694f621d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.kt @@ -0,0 +1,99 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 29 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, properties, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Class?) { + if (x?.prop_8?.prop_8?.prop_8?.prop_8 != null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Class?) { + if (x?.prop_8?.prop_8?.prop_8?.prop_8 !== null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Class?) { + if (x?.prop_8?.prop_8?.prop_8?.prop_8 == null) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30369 + */ +fun case_4(x: Class?) { + if (x?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: T) { + if (x?.propNullableT != null) { + x + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Inv?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_2 != null) { + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) + } +} + +// TESTCASE NUMBER: 7 +inline fun case_7(x: Inv?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_2 == null) else { + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Inv?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_1 == null) else { + & Inv?")!>x.prop_1.prop_1.prop_1.prop_1 + "), DEBUG_INFO_SMARTCAST!>x.prop_1.prop_1.prop_1.prop_1.equals(10) + } +} + +// TESTCASE NUMBER: 9 +inline fun case_9(x: Out?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_1 != null) { + & Inv?")!>x.prop_1.prop_1.prop_1.prop_1 + "), DEBUG_INFO_SMARTCAST!>x.prop_1.prop_1.prop_1.prop_1.equals(10) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.3.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.3.kt rename to compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt index 66063e6df6a..0be8a3e5dad 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.3.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt @@ -3,18 +3,11 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 + * SECTIONS: dfa * NUMBER: 3 - * DESCRIPTION: Smartcasts to `Nothing?` from nullability condition (value or reference equality) using if expression and simple types. - * UNSPECIFIED BEHAVIOR + * DESCRIPTION: Raw data flow analysis test * HELPERS: objects, enumClasses, classes, properties, typealiases */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt new file mode 100644 index 00000000000..3eb34dcc535 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt @@ -0,0 +1,187 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 30 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, properties, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_1(x: Class?) { + if (x!!.prop_8?.prop_8?.prop_8?.prop_8 != null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_2(x: Class?) { + if (x?.prop_8!!.prop_8?.prop_8?.prop_8 !== null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_3(x: Class?) { + if (x?.prop_8?.prop_8?.prop_8!!.prop_8 == null) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_4(x: Class?) { + if (x!!?.prop_8?.prop_8?.prop_8?.prop_8 == null == true) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_5(x: Class?) { + if (x?.prop_8!!?.prop_8?.prop_8?.prop_8 == null == true) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_6(x: Class?) { + if (x?.prop_8?.prop_8?.prop_8!!?.prop_8 == null == true) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_7(x: Class) { + if (x!!.prop_8?.prop_8?.prop_8?.prop_8 != null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_8(x: Class) { + if (x!!.prop_8?.prop_8?.prop_8?.prop_8 != null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} +// TESTCASE NUMBER: 9 +fun case_9(x: T) { + if (x!!.propNullableT != null) { + x + x.propNullableT + } +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_10(x: Inv?) { + if (x!!.prop_1?.prop_1?.prop_1?.prop_2 != null) { + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) + } +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +inline fun case_11(x: Inv?) { + if (x?.prop_1!!.prop_1?.prop_1?.prop_2 == null) else { + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) + } +} + +/* + * TESTCASE NUMBER: 12 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_12(x: Inv?) { + if (x?.prop_1?.prop_1?.prop_1!!.prop_1 == null) else { + ?")!>x.prop_1.prop_1.prop_1.prop_1 + ?")!>x.prop_1.prop_1.prop_1.prop_1.equals(10) + } +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +inline fun case_13(x: Out?) { + if (x?.prop_1?.prop_1!!.prop_1?.prop_1 != null) { + ?")!>x.prop_1.prop_1.prop_1.prop_1 + ?")!>x.prop_1.prop_1.prop_1.prop_1.equals(10) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.kt new file mode 100644 index 00000000000..23b300ad076 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.kt @@ -0,0 +1,141 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 31 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, properties, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_1(x: Any?) { + if ((x as Class).prop_8?.prop_8?.prop_8?.prop_8 != null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_2(x: Class?) { + if ((x as Class).prop_8?.prop_8?.prop_8?.prop_8 !== null) { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_3(x: Any?) { + if ((x as Class?)?.prop_8?.prop_8?.prop_8?.prop_8 == null) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_4(x: Any?) { + if ((x as Class?)!!.prop_8?.prop_8?.prop_8?.prop_8 == null) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_5(x: Class?) { + if ((x?.prop_8 as Class).prop_8?.prop_8?.prop_8 == null == true) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8 + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_6(x: Class?) { + if ((x?.prop_8?.prop_8?.prop_8 as Class?)?.prop_8 == null == true) else { + x + x.prop_8 + x.prop_8.prop_8 + x.prop_8.prop_8.prop_8 + x.prop_8.prop_8.prop_8.prop_8.prop_8 + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: T) { + if ((x as Any).propNullableT != null) { + x + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Inv?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_2 != null) { + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) + } +} + +// TESTCASE NUMBER: 7 +inline fun case_7(x: Inv?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_2 == null) else { + x.prop_1.prop_1.prop_1.prop_2 + x.prop_1.prop_1.prop_1.prop_2.equals(10) + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Inv?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_1 == null) else { + & Inv?")!>x.prop_1.prop_1.prop_1.prop_1 + "), DEBUG_INFO_SMARTCAST!>x.prop_1.prop_1.prop_1.prop_1.equals(10) + } +} + +// TESTCASE NUMBER: 9 +inline fun case_9(x: Out?) { + if (x?.prop_1?.prop_1?.prop_1?.prop_1 != null) { + & Inv?")!>x.prop_1.prop_1.prop_1.prop_1 + "), DEBUG_INFO_SMARTCAST!>x.prop_1.prop_1.prop_1.prop_1.equals(10) + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.kt new file mode 100644 index 00000000000..37d2a387e67 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.kt @@ -0,0 +1,31 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 32 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: T?, y: K?) { + x as T + y as K + val z = x ?: y + + x.equals(10) + z + z.equals(10) +} + +// TESTCASE NUMBER: 1 +inline fun case_2(y: K?) { + y as K + + y + y.equals(10) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.kt new file mode 100644 index 00000000000..b0ef6d5a97c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.kt @@ -0,0 +1,96 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 33 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + var x: Any? = null + + if (true) { + x = 42 + } else { + x = 42 + } + + x + x.inv() +} + +// TESTCASE NUMBER: 2 +fun case_2() { + val x: Any? + + if (true) { + x = 42 + } else { + x = 42.0 + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: Any? = null + + if (true) { + x = ClassLevel2() + } else { + x = ClassLevel3() + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 4 +fun case_4() { + val x: Any? + + if (true) { + return + } else { + x = 42.0 + } + + x + x.minus(10.0) +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Any? + + if (true) { + throw Exception() + } else { + x = 42.0 + } + + x + x.minus(10.0) +} + +// TESTCASE NUMBER: 6 +fun case_6() { + val x: Any? + + if (true) { + x = 42.0 + } else { + null!! + } + + x + x.minus(10.0) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.kt new file mode 100644 index 00000000000..a7a3a7c2ed4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.kt @@ -0,0 +1,148 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 34 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + var a: Any? = null + if (a == null) return + val b = select(a) + val c = a + b + c + c.equals(10) + b.equals(10) +} + +// TESTCASE NUMBER: 2 +fun case_2(a: Any?) { + if (a is String) { + val b = a + b + b.length + } +} + +// TESTCASE NUMBER: 3 +fun case_3(a: Any?) { + if (a is String) { + val b = a + val c = b + val d = c + val e = d + e + e.length + } +} + +// TESTCASE NUMBER: 4 +fun case_4(a: Any?) { + if (a is ClassLevel1) { + val b = a + if (b is ClassLevel2) { + val c = b + if (c is ClassLevel3) { + val d = c + if (d is ClassLevel4) { + val e = d + if (e is ClassLevel5) { + e + e.test1() + e.test2() + e.test3() + e.test4() + e.test5() + } + } + } + } + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * DISCUSSION: Smartcast due to `e as? ClassLevel5 ?: e as ClassLevel5` + * ISSUES: KT-30503 + */ +fun case_5(a: Any?) { + val b: Any? + val c: Any? + val d: Any? + val e: Any? + if ( + a is ClassLevel1 + && if (true) {b = a; false} else {b = a;true} + && b as ClassLevel2 is ClassLevel2 + && if (true) {c = b;false} else {c = b;false} + && try {c as ClassLevel3;true} finally {c as ClassLevel3;false} + && when (true) {else -> {d = c;true}} + && when (true) {else -> {d as ClassLevel4;false}} + && if (true) {e = d;false} else {e = d;true} + && if (true) {e as? ClassLevel5 ?: e as ClassLevel5;true} else {e as? ClassLevel5 ?: e as ClassLevel5;false} + ) { + e + e.test1() + e.test2() + e.test3() + e.test4() + e.test5() + } +} + +// TESTCASE NUMBER: 5 +fun case_6() { + val b: Any? + val c: Any? + val d: Any? + val e: Any? + + when (if (true) {b = 11} else {b = 12}) { + when (if (true) {b.inv(); c = b; c as ClassLevel1;} else {b.inv(); c = b; c as ClassLevel1;}) { + else -> kotlin.Unit + } -> when (if (true) {c.test1(); d = c; d as ClassLevel2} else {c.test1(); d = c; d as ClassLevel2}) { + when (if (true) {d.test2(); e = d; e as ClassLevel3} else {d.test2(); e = d; e as ClassLevel3}) { + else -> ClassLevel2() + } -> { + e + println(e.inv()) + println(e.test1()) + println(e.test2()) + println(e.test3()) + } + else -> { + e + println(e.inv()) + println(e.test1()) + println(e.test2()) + println(e.test3()) + } + } + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + */ +fun case_7() { + val d = ClassLevel1() + var e: Any? + + e = d + e as ClassLevel2 + e = d + + e + e.test1() + e.test2() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.kt new file mode 100644 index 00000000000..55a2191160c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.kt @@ -0,0 +1,95 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 35 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_1(x: Any?) { + while (true) { + x ?: return + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any?) { + while (true) { + x ?: return + x + } + + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_3(x: Any?) { + while (true) { + x ?: return ?: x + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?) { + while (true) { + x ?: break + x + x.equals(10) + } + + x +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + while (true) { + x ?: continue + x + x.equals(10) + } + + x +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + do { + x ?: continue + x + x.equals(10) + } while (false) + + x +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any?) { + do { + x ?: break + x + x.equals(10) + } while (false) + + x +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.kt new file mode 100644 index 00000000000..ad2d7047c63 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.kt @@ -0,0 +1,192 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_VARIABLE -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 36 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, functions, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + var a: Any? = null + + if (a == null) return + + val b = select(a) + val c = a + + b + b.equals(10) + c + c.equals(10) +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any) { + if (x is String) { + val y = x + x + y + y.length + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x is Number?) { + var y = x + if (y == null) throw Exception() + var z = y + x + y + z + y.toByte() + z.toByte() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?) { + if (x is Number?) { + var y = x + while (true && y != null) { + var z = y + x + y + z + y.toByte() + z.toByte() + } + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + var y = x + while (false || y != null) { + if (y is Number) { + val z = select(y) + x + y + z + y.toByte() + z.toByte() + } + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + var y = x ?: null!! + while (false || y is Number) { + x + y + y.toByte() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any?, z: Any) { + var y = x ?: null!! + while (false || y === z) { + x + y + y.equals(10) + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?, z: Any) { + var y = x ?: null!! + y == z || return + x + y + y.equals(10) +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?, z: Any) { + var y = select(x) ?: return null!! + z == y || throw null!! + x + y + y.equals(10) +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?, z: Any, b: Boolean?) { + var y = x ?: when (b) { + true -> null!! + false -> return + null -> throw Exception() + } + z === y || if (b == true) return else if (b === false) null!! else throw Exception() + x + y + y.equals(10) +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?, z: Any, b: Boolean?) { + while (true) { + var y = x ?: if (b == true) continue!! else if (!(b != false)) return else break ?: break::class + z !== y && if (b == true) return else if (b === false) null!!else throw Exception() + x + y + y.equals(10) + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Any?, z: Any, b: Boolean?) { + while (true) { + var y = select(x) ?: if (b == true) continue!! else if (!(b != false)) return else break ?: break::class + select(z) !== y && if (b == true) return else if (b === false) null!!else throw Exception() + x + y + y.equals(10) + } +} + +// TESTCASE NUMBER: 13 +fun case_13(x: Any?) { + if (x is Number?) { + var y = select(select(select(select(select(select(x)))))) + if (y == null) throw Exception() + var z = select(select(select(select(y), select(y)), select(select(y), select(y))), select(select(select(y), select(y)), select(select(y), select(y)))) + x + y + z + y.toByte() + z.toByte() + } +} + +// TESTCASE NUMBER: 14 +fun case_14(x: Any?) { + if (x is Number?) { + var y = removeNullable(x) + x + y + y.toByte() + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: Any?) { + if (x is Number?) { + var y = removeNullable(removeNullable(removeNullable(removeNullable(x), removeNullable(x)), removeNullable(removeNullable(x), removeNullable(x))), removeNullable(removeNullable(removeNullable(x), removeNullable(x)), removeNullable(removeNullable(x), removeNullable(x)))) + if (y !is Int) throw Exception() + var z = select(select(select(select(y), select(y)), select(select(y), select(y))), select(select(select(y), select(y)), select(select(y), select(y)))) + x + y + z + y.inv() + z.inv() + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.kt new file mode 100644 index 00000000000..a2faa2b0732 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.kt @@ -0,0 +1,220 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 37 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_1(x: Any?) { + while (true) { + x ?: return + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 2 +fun case_2(a: Any?) { + while (true) { + a ?: return + a + } + + a + a.equals(10) +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_3(x: Int?) { + while (true) { + x ?: return ?: x + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Boolean?) { + while (true && (x == true || x == null)) { + x ?: return + } + + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_5(x: Boolean?) { + while (true) { + x ?: x ?: null!! + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Boolean?) { + while (true) { + if (x != true) throw Exception() + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Boolean?) { + while (true) { + if (!(x === false)) return + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Boolean?) { + while (x ?: return) + + x + x.equals(10) +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Boolean?) { + while (x ?: return) + while (x == null) + + x + x.equals(10) +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Boolean?) { + while (true) { + x ?: return + while (x) {} + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Boolean?) { + while (true) { + x ?: return + break + x + } + + x + x.equals(10) +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Boolean?) { + while (true) { + x ?: return + break && x + } + + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_13(x: Boolean?) { + while (true) { + x ?: x!! + } + + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_14(x: Boolean?) { + do { + x ?: return + } while(false) + + x + x.equals(10) +} + +// TESTCASE NUMBER: 15 +fun case_15(x: Boolean?) { + do { + x ?: return + println(1) + } while(false) + + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 16 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30756 + */ +fun case_16(x: Boolean?) { + do { + x ?: x!! + } while(false) + + x + x.equals(10) +} + +// TESTCASE NUMBER: 17 +fun case_17(x: Boolean?, y: Boolean?) { + loop@ while (true) { + when (y) { + true -> x!! + false -> x!! + null -> if (true) if (true) if (true) if (true) if (true) when (y) { + true -> when (y) { + else -> if (true) if (true) if (true) if (true) if (true) x!! else x!! else x!! else x!! else x!! else x!! + } + false -> x!! + null -> if (true) if (true) if (true) if (true) if (true) x!! else x!! else x!! else x!! else x!! else x!! + } else x!! else x!! else x!! else x!! else x!! + } + break@loop + } + + x + x.not() +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.kt new file mode 100644 index 00000000000..9e049683f51 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.kt @@ -0,0 +1,91 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 38 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Comparable<*>?) { + if (x is Byte?) { + ?")!>x + ?")!>x?.equals(10) + x!!.dec() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: ClassWithThreeTypeParameters<*, *, *>?) { + if (x is InterfaceWithTwoTypeParameters<*, *>?) { + ? & InterfaceWithTwoTypeParameters<*, *>?")!>x + ? & InterfaceWithTwoTypeParameters<*, *>?")!>x?.x + x?.y + x?.z + & InterfaceWithTwoTypeParameters}")!>x!!.ip2test() + & ClassWithThreeTypeParameters<*, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x + & ClassWithThreeTypeParameters<*, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x.x + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: ClassWithThreeTypeParameters<*, *, *>) { + if (x is InterfaceWithTwoTypeParameters<*, *>?) { + & InterfaceWithTwoTypeParameters<*, *>")!>x + & InterfaceWithTwoTypeParameters<*, *>")!>x.x + x.y + x.z + & InterfaceWithTwoTypeParameters}")!>x!!.ip2test() + & InterfaceWithTwoTypeParameters<*, *>")!>x + & InterfaceWithTwoTypeParameters<*, *>")!>x.x + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: ClassWithSixTypeParameters<*, *, *, *, *, *>?) { + if (x is InterfaceWithTwoTypeParameters<*, *>) { + & ClassWithSixTypeParameters<*, *, *, *, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x + & ClassWithSixTypeParameters<*, *, *, *, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x.x + x.y + x.z + x.u + & InterfaceWithTwoTypeParameters}")!>x!!.ip2test() + & ClassWithSixTypeParameters<*, *, *, *, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x + & ClassWithSixTypeParameters<*, *, *, *, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x.x + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: ClassWithThreeTypeParameters<*, *, *>?) { + if (x is InterfaceWithTwoTypeParameters<*, *>?) { + if (x === null) return + & ClassWithThreeTypeParameters<*, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x + & ClassWithThreeTypeParameters<*, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x.x + x.y + x.z + & ClassWithThreeTypeParameters<*, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x.ip2test() + & ClassWithThreeTypeParameters<*, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x + & ClassWithThreeTypeParameters<*, *, *>? & InterfaceWithTwoTypeParameters<*, *>")!>x.x + } +} + +// TESTCASE NUMBER: 6 +fun case_5(x: Any?) { + if (x is ClassWithThreeTypeParameters<*, *, *>?) { + if (x is InterfaceWithTwoTypeParameters<*, *>?) { + if (x === null) return + & InterfaceWithTwoTypeParameters<*, *> & kotlin.Any & kotlin.Any?")!>x + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x.x + x.y + x.z + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x.ip2test() + & InterfaceWithTwoTypeParameters<*, *> & kotlin.Any & kotlin.Any?")!>x + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>x.x + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt new file mode 100644 index 00000000000..c49bb70edb9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt @@ -0,0 +1,73 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 39 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_1(x: Number?) { + val y: Int? = null + + if (x == y) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Number) { + val y: Int? = null + + if (x === y) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Number) { + var y: Int? = null + + if (x === y) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_4() { + var x: Number? = null + var y: Int? = null + + if (x == y) { + x + x?.inv() + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_5(x: Class, y: Class) { + if (x.prop_14 == y.prop_15) { + ?")!>x.prop_14 + ?")!>x.prop_14.inv() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.4.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.kt similarity index 95% rename from compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.4.kt rename to compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.kt index beda27d750d..3f8acb3438b 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.4.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.kt @@ -3,18 +3,11 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 + * SECTIONS: dfa * NUMBER: 4 - * DESCRIPTION: Smartcasts to `Nothing` from nullability condition (value or reference equality) using if expression and simple types. - * UNSPECIFIED BEHAVIOR + * DESCRIPTION: Raw data flow analysis test * HELPERS: objects, enumClasses, classes, properties, typealiases */ diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.kt new file mode 100644 index 00000000000..a12fd20d35e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.kt @@ -0,0 +1,173 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 40 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-28242 + */ +fun case_1(x: Any?) { + if (x is Int?) { + x!!.inv() + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-28242 + */ +fun case_2(x: Any?) { + if (x is Int?) { + (x as Int).inv() + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x is Int?) { + x!!.run { + inv() + } + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?) { + if (x is Int?) { + select(x!!).inv() + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + x!! + if (x is Int?) { + x.inv() + select(x).inv() + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (x is Boolean? && x!!) { + x.not() + select(x).not() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Boolean?) { + if (x != null && x!!) { + x.not() + select(x).not() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (x != null && x is Boolean?) { + x.not() + select(x).not() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (x is Boolean? && x != null) { + x.not() + select(x).not() + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + if (x as Boolean) { + x.not() + select(x).not() + } +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_11(x: Any?) { + if ((x as Boolean?)!!) { + x.not() + select(x).not() + } +} + +/* + * TESTCASE NUMBER: 12 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_12(x: Any?) { + if (x!! as Boolean?) { + x.not() + select(x).not() + } +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30376 + */ +fun case_13(x: Any?) { + if (x as Boolean? ?: x!!) { + x.not() + select(x).not() + } +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28430 + */ +fun case_14(x: Any?) { + if (x == null) { + x + x?.equals(10) + x!!.equals(10) + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 15 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28430 + */ +fun case_15(x: Any?) { + if (x !== null) else { + x + x?.equals(10) + x!!.equals(10) + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 16 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28430 + */ +fun case_16(x: Nothing?) { + x + x?.equals(10) + x!!.equals(10) + x.equals(10) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.kt new file mode 100644 index 00000000000..5e12c2a1b14 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.kt @@ -0,0 +1,66 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 41 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-28362 + */ +fun case_1(x: Any) { + if (x is Interface1) { + if (x is Interface2) { + x + x.itest() + x.itest1() + x.itest2() + } + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-28362 + */ +fun case_2(x: Any) { + if (x is Interface2) { + if (x is Interface1) { + x + x.itest0() + } + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-28362 + */ +fun case_3(x: Any) { + if (x is Interface1) { + if (x is Interface2) { + x + x.itest000() + } + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-28362 + */ +fun case_4(x: Any) { + if (x is Interface2) { + if (x is Interface1) { + x + x.itest0000() + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.kt new file mode 100644 index 00000000000..726e3ffddde --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.kt @@ -0,0 +1,55 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 42 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-19446 + */ +fun case_1() { + var x: Boolean? = true + x!! + val y = { + val x: Int? + x = 10 + } + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-19446 + */ +fun case_2() { + var x: Boolean? = true + x!! + val y = { + var x: Int? = 10 + x = 10 + } + x + x.equals(10) +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: Boolean? = true + x!! + val y = { + var x: Int? = 10 + } + x + x.equals(10) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.kt new file mode 100644 index 00000000000..383458ea4de --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.kt @@ -0,0 +1,126 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 43 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-28670 + */ +fun case_1(a: Interface1?, b: Interface2?) { + b as Interface1? + a as Interface2? + val c = select(a, b) + if (c != null) { + c.itest() + c.itest1() + c.itest2() + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-28670 + */ +fun case_2(a: Interface1?, b: Interface2?) { + b as Interface1? + a as Interface2? + + select(a, b)!!.run { + this.itest() + this.itest1() + this.itest2() + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-28670 + */ +fun case_3(a: Interface1?, b: Interface2?) { + b as Interface1? + a as Interface2? + + val c = select(a, b)!! + c.itest() + c.itest1() + c.itest2() +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-28670 + */ +fun case_4(a: Interface1?, b: Interface2?) { + b as Interface1? + a as Interface2? + + val c = select(a, b) ?: return + c.itest() + c.itest1() + c.itest2() +} + +/* + * TESTCASE NUMBER: 5 + * ISSUES: KT-28670 + */ +fun case_5(a: Interface1?, b: Interface2?) { + b as Interface1? + a as Interface2? + + val foo = l1@ fun(): Any { + val bar = l2@ fun() { + val c = select(a, b) ?: return@l2 + c.itest() + c.itest1() + c.itest2() + } + return bar + } + println(foo) +} + +/* + * TESTCASE NUMBER: 6 + * ISSUES: KT-28670 + */ +fun case_6(a: Interface1?, b: Interface2?) { + b as Interface1? + a as Interface2? + + val c = select(a, b) + c ?: return + c.itest() + c.itest1() + c.itest2() +} + +/* + * TESTCASE NUMBER: 7 + * ISSUES: KT-28670 + */ +fun case_7(a: Interface1?, b: Interface2?) { + b as Interface1? + a as Interface2? + + val foo = l1@ fun(): Any { + val bar = l2@ fun() { + val c = select(a, b) + c ?: return@l2 + c.itest() + c.itest1() + c.itest2() + } + return bar + } + println(foo) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.kt new file mode 100644 index 00000000000..33ff9f5984c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.kt @@ -0,0 +1,62 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 44 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28760 + */ +fun Int?.case_1() { + val x = this + if (x != null) { + this + this.inv() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28760 + */ +fun Int?.case_2() { + val x = this + if (this != null) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28760 + */ +fun Int?.case_3() { + val x = this + this!! + x + x.inv() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28760 + */ +fun Int?.case_4() { + val x = this + x!! + this + this.inv() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.kt new file mode 100644 index 00000000000..4a1ffa21321 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.kt @@ -0,0 +1,114 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 45 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28759 + */ +fun case_1() { + val x: Int? = 10 + val y: Int? + y = x + if (y != null) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28759 + */ +fun case_2() { + val x: Int? = 10 + val y: Int? + y = x + y!! + x + x.inv() +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28759 + */ +fun case_3() { + var x: Int? = 10 + val y: Int? + y = x + y!! + x + x.inv() +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28759 + */ +fun case_4() { + val x: Int? = 10 + var y: Int? + y = x + if (y != null) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Int? + val y: Int? + x = 10;y = x + if (y != null) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 6 +fun case_6() { + var x: Int? + val y: Int? + x = 10;y = x + if (y != null) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + val x: Int? + var y: Int? + x = 10;y = x + if (y != null) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 8 +fun case_8() { + var x: Int? + var y: Int? + x = 10;y = x + if (y != null) { + x + x.inv() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.kt new file mode 100644 index 00000000000..9f3e7614c77 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.kt @@ -0,0 +1,123 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT +// WITH_REFLECT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 46 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +import kotlin.reflect.* + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29936 + */ +fun case_1(x: Int?) { + if (x != funNothingQuest() == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29936 + */ +fun case_2(x: Int?) { + operator fun Nothing?.not() = null + if (x != !null != false) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29936 + */ +fun case_3(x: Int?) { + if (x == funWithoutArgs() == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29936 + */ +fun case_4(x: Int?, y: List) { + if (x == y[0] == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_5(x: Int?) { + val y = object { + val z = null + } + + if (x == y.z == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_6(x: Int?) { + val y = null + + if (x == y == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_7(x: Int?) { + val y = object { + val z: Nothing? + get() = null + } + + if (x == y.z == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28265 + */ +fun case_8(x: KClass?) { + if (x == EmptyObject::class == true) { + ?")!>x + ?")!>x.java + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.kt new file mode 100644 index 00000000000..575f1f8709b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.kt @@ -0,0 +1,81 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 47 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(a: Any?) { + while (true) { + if (a == null) return + if (true) break + } + + a + a.equals(10) +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + */ +fun case_2(a: Any?) { + while (true) { + if (a == null) continue + if (true) break + } + + a + a.equals(10) +} + +// TESTCASE NUMBER: 3 +fun case_3(a: Any?) { + while (true) { + if (a == null) return continue + if (true) break + } + + a + a.equals(10) +} + +// TESTCASE NUMBER: 4 +fun case_4(a: Any?) { + while (true) { + if (a == null) throw Exception() + break + } + + a + a.equals(10) +} + +// TESTCASE NUMBER: 5 +fun case_5(a: Any?) { + while (true) { + if (a == null) return throw Exception() + if (true) break + } + + a + a.equals(10) +} + +// TESTCASE NUMBER: 6 +fun case_6(a: Any?) { + while (true) { + if (a == null) return throw Exception() + break + } + + a + a.equals(10) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt new file mode 100644 index 00000000000..d56385eaba6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt @@ -0,0 +1,68 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 48 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30317 + */ +fun case_1(x: Any?, y: Any?) { + if (x!! === y) { + x + x.equals(10) + y + y.equals(10) + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30317 + */ +fun case_2(x: Any?, y: Any?) { + if (x as Int === y) { + x + x.inv(10) + y + y.inv(10) + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30317 + */ +fun case_3(x: Any?, y: Any?) { + if (y === x!!) { + x + x.equals(10) + y + y.equals(10) + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30317 + */ +fun case_4(x: Any?, y: Any?) { + if (y === x as Int) { + x + x.inv(10) + y + y.inv(10) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt new file mode 100644 index 00000000000..cee0c20d232 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt @@ -0,0 +1,60 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 49 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: annotations, classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29935 + */ +fun case_1(x: Any?) { + if (x is Int == @RetentionSourceAndTargetExpression true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29935 + */ +fun case_2(x: Int?) { + if (x != @RetentionSourceAndTargetExpression null == true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29935 + */ +fun case_3(x: Int?, y: Int) { + if (x == y == @RetentionSourceAndTargetExpression true) { + x + x.inv() + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29935 + */ +fun case_4(x: Int?, y: Int) { + if (@RetentionSourceAndTargetExpression !!(x == y)) { + x + x.inv() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.5.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.kt similarity index 52% rename from compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.5.kt rename to compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.kt index b02605ca9cb..418abfe7b11 100644 --- a/compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.5.kt +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.kt @@ -3,21 +3,12 @@ // SKIP_TXT /* - * KOTLIN DIAGNOSTICS SPEC TEST (POSITIVE) + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) * - * SPEC VERSION: 0.1-draft - * PLACE: type-inference, smart-casts, smart-casts-sources -> paragraph 4 -> sentence 1 - * RELEVANT PLACES: - * paragraph 4 -> sentence 2 - * paragraph 1 -> sentence 2 - * paragraph 6 -> sentence 1 - * paragraph 9 -> sentence 1 - * paragraph 9 -> sentence 2 - * paragraph 9 -> sentence 3 - * paragraph 9 -> sentence 4 + * SECTIONS: dfa * NUMBER: 5 - * DESCRIPTION: Smartcasts from nullability condition (value or reference equality) using if expression and simple intersection types from other smartcasts. - * HELPERS: classes, interfaces + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, interfaces, properties, functions */ // TESTCASE NUMBER: 1 @@ -25,7 +16,15 @@ fun case_1(x: Any?) { if (x is Number?) { if (x !== null) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() } } } @@ -34,7 +33,15 @@ fun case_1(x: Any?) { fun case_2(x: Any?) { if (x is Number? && x is Int? && x != null) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() } } @@ -44,7 +51,15 @@ fun case_3(x: Any?) { if (x !== null) { if (x is Int?) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() } } } @@ -56,7 +71,15 @@ fun case_4(x: Any?) { if (x is Number) { if (x is Int?) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() } } } @@ -71,7 +94,15 @@ fun case_5(x: Any?) { if (x is ClassLevel5?) { if (x != null) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() x.test1() x.test2() x.test3() @@ -93,7 +124,15 @@ fun case_6(x: Any?) { if (x != null && x is ClassLevel4?) { if (x is ClassLevel5?) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() x.test1() x.test2() x.test3() @@ -111,7 +150,15 @@ fun case_7(x: Any?) { if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { if (x is ClassLevel4? && x != null && x is ClassLevel5?) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() x.test1() x.test2() x.test3() @@ -126,7 +173,15 @@ fun case_8(x: Any?) { if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { if (x is ClassLevel4? && x != null && x is ClassLevel5?) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() x.test1() x.test2() x.test3() @@ -140,7 +195,15 @@ fun case_8(x: Any?) { fun case_9(x: Any?) { if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3? && x is ClassLevel4? && x != null && x is ClassLevel5?) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() x.test1() x.test2() x.test3() @@ -156,7 +219,15 @@ fun case_10(x: Any?) { } else if (x is ClassLevel5? && x != null) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() x.test1() x.test2() x.test3() @@ -165,7 +236,15 @@ fun case_10(x: Any?) { } } else if (x is ClassLevel4? && x != null && x is ClassLevel5?) { x - x.equals(x) + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() x.test1() x.test2() x.test3() @@ -285,12 +364,28 @@ fun case_15(x: Any?) { fun case_16(a: Any?, b: Int = if (a is Number? && a is Int? && a !== null) a else 0) { a b - b.equals(b) + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() } // TESTCASE NUMBER: 17 fun case_17(a: Any?, b: Int = if (a !is Number? || a !is Int? || a == null) 0 else a) { a b - b.equals(b) + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() } diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.kt new file mode 100644 index 00000000000..f0ee96c8535 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.kt @@ -0,0 +1,116 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 50 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun Any.case_1() { + if (this is Inv<*>) { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.test() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.prop_4 + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.prop_4.inv() + prop_4 + prop_4.inv() + } +} + +// TESTCASE NUMBER: 2 +fun Any.case_2() { + if (this is ClassWithSixTypeParameters<*, *, *, *, *, *>) { + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.test() + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.x + "), DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any"), DEBUG_INFO_SMARTCAST!>this.y + x + y + } +} + +// TESTCASE NUMBER: 3 +fun T.case_3() { + if (this is Inv<*>) { + "), DEBUG_INFO_EXPRESSION_TYPE("T"), DEBUG_INFO_SMARTCAST!>this.test() + "), DEBUG_INFO_EXPRESSION_TYPE("T"), DEBUG_INFO_SMARTCAST!>this.prop_4 + "), DEBUG_INFO_EXPRESSION_TYPE("T"), DEBUG_INFO_SMARTCAST!>this.prop_4.inv() + prop_4 + prop_4.inv() + } +} + +// TESTCASE NUMBER: 4 +fun T?.case_4() { + if (this is ClassWithSixTypeParameters<*, *, *, *, *, *>) { + "), DEBUG_INFO_EXPRESSION_TYPE("T?"), DEBUG_INFO_SMARTCAST!>this.test() + "), DEBUG_INFO_EXPRESSION_TYPE("T?"), DEBUG_INFO_SMARTCAST!>this.x + "), DEBUG_INFO_EXPRESSION_TYPE("T?"), DEBUG_INFO_SMARTCAST!>this.y + x + y + } +} + +// TESTCASE NUMBER: 5 +fun ClassWithSixTypeParameters.case_5() { + if (this is InterfaceWithFiveTypeParameters1<*, *, *, *, *>) { + & InterfaceWithFiveTypeParameters1<*, *, *, *, *>"), DEBUG_INFO_EXPRESSION_TYPE("ClassWithSixTypeParameters")!>this.itest1() + itest1() + & InterfaceWithFiveTypeParameters1<*, *, *, *, *>"), DEBUG_INFO_EXPRESSION_TYPE("ClassWithSixTypeParameters")!>this.test() + & InterfaceWithFiveTypeParameters1<*, *, *, *, *>"), DEBUG_INFO_EXPRESSION_TYPE("ClassWithSixTypeParameters")!>this.x + & InterfaceWithFiveTypeParameters1<*, *, *, *, *>"), DEBUG_INFO_EXPRESSION_TYPE("ClassWithSixTypeParameters")!>this.y + x + y + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25432 + */ +fun case_6(y: Inv) { + if (y.prop_3 is MutableList<*>) { + y.prop_3 + y.prop_3[0] + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25432 + */ +fun Inv.case_7() { + if (this.prop_3 is MutableList<*>) { + this.prop_3 + this.prop_3[0] + prop_3 + prop_3[0] + } +} + +// TESTCASE NUMBER: 8 +fun T.case_8() { + this as MutableList + ")!>this::equals + this.equals(10) + ")!>::equals + equals(10) +} + +/* + * TESTCASE NUMBER: 9 + * ISSUES: KT-8966 + */ +fun T.case_9() { + if (this is String) { + this + this.length + length + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.kt new file mode 100644 index 00000000000..e6fb2e1792a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.kt @@ -0,0 +1,356 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 51 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + val y = run { + if (x is Class) + return@run x + Class() + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Class?) { + val y = run { + x!! + return@run x + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 3 +fun case_3(z: Any?) { + val y = run { + when (z) { + is Class? -> z!! + is Class -> return@run z + is Float -> Class() + else -> return@run Class() + } + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 4 +fun case_4(z: Any?) { + val y = run { + when (z) { + is Class? -> z!! + is Class -> return@run z + is Float -> Class() + else -> return@run Class() + } + Class() + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 5 +fun case_5(z: Any?) { + val y = run { + when (z) { + is Class? -> z!! + is Class -> return@run z + is Float -> Class() + else -> return@run Class() + } + "" + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 6 +fun case_6(z: Any?) { + val y = z.let { + when (it) { + is Class? -> it!! + is Class -> return@let it + is Float -> Class() + else -> return@let Class() + } + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 7 +fun case_7(z: Any?) { + val y = z.let { + it as Class + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 8 +fun case_8(z: Any?) { + val y = z.let { + return@let it as Class + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 9 +fun case_9(z: Any?) { + val y = z.run { + this as Class + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 10 +fun case_10(z: Any?) { + val y = z.run { + return@run this as Class + } + y + y.fun_1() +} + +// TESTCASE NUMBER: 11 +fun case_11(z: Any?, x: Any?) { + val y = z.let { + if (it is ClassLevel6) + return@let it + x as ClassLevel3 + } + y + y.test3() +} + +// TESTCASE NUMBER: 12 +fun case_12(z: Any?) { + val y = z.let { + return@let it as Int + it as? Float ?: 10f + } + & Number}")!>y + & Number}")!>y.toByte() +} + +/* + * TESTCASE NUMBER: 13 + * ISSUES: KT-30927 + */ +fun case_13(z: Any?) { + val y = z.run { + if (this is ClassLevel6) + return@run this + this as ClassLevel3 + } + y + y.test3() +} + +// TESTCASE NUMBER: 14 +fun case_14(z: Any?) { + val y = z.run { + return@run this as Int + this as? Float ?: 10f + } + & Number}")!>y + & Number}")!>y.toByte() +} + +/* + * TESTCASE NUMBER: 15 + * NOTE: 'Any' is common super type between kotlin.Unit (obtained using coersion to Unit) and Int + */ +fun case_15(z: Any?) { + val y = z.let { + return@let it as Int + while (true) { println(1) } + } + y + y.equals(10) +} + +/* + * TESTCASE NUMBER: 16 + * NOTE: 'Any' is common super type between kotlin.Unit (obtained using coersion to Unit) and Int + */ +fun case_16(z: Any?) { + val y = z.run { + return@run this as Int + while (true) { println(1) } + } + y + y.equals(10) +} + +/* + * TESTCASE NUMBER: 17 + * ISSUES: KT-30927 + */ +fun case_17(z: Any?) { + val y = z.run { + when (this) { + is Class? -> this!! + is Class -> return@run this + is Float -> Class() + else -> return@run Class() + } + } + y + y.fun_1() +} + +/* + * TESTCASE NUMBER: 18 + * ISSUES: KT-30927 + */ +fun case_18(z: Any?) { + val y = z.run { + this as Int + this + } + y + y.inv() +} + +// TESTCASE NUMBER: 19 +fun case_19(z: Any?) { + val y = z.let { + it as Int + it + } + y + y.inv() +} + +/* + * TESTCASE NUMBER: 20 + * ISSUES: KT-30927 + */ +fun case_20(z: Any?) { + val y = z.run { + this!! + this + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 21 +fun case_21(z: Any?) { + val y = z.run { + if (true) this as Any else this!! + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 22 +fun case_22(z: Any?) { + val y = z.let { + if (true) it as Any else it!! + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 23 +fun case_23(z: Any?) { + val y = z.run { + when (this) { + true -> this!! + 0.0 -> this as Any + else -> this!! + } + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 24 +fun case_24(z: Any?) { + val y = z.let { + when (it) { + true -> it!! + 0.0 -> it as Any + else -> it!! + } + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 25 +fun case_25(z: Any?) { + val y = z.run { + when (this) { + true -> this + if (true) this as Int else this as Float -> this + return@run this as Float -> this + else -> this!! + } + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 26 +fun case_26(z: Any?) { + val y = z.let { + when (it) { + true -> it + if (true) it as Int else it as Float -> it + return@let it as Int -> it + else -> it!! + } + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 27 +fun case_27(z: Any?) { + val y = z.let { + if (it == null) return@let Any() + it + } + y + y.equals(10) +} + +/* + * TESTCASE NUMBER: 28 + * ISSUES: KT-30927 + */ +fun case_28(z: Any?) { + val y = z.run { + if (this == null) throw IllegalStateException() + this + } + y + y.equals(10) +} + +// TESTCASE NUMBER: 29 +fun case_29(z: Any?) { + val y = z.let { + if (it == null) throw IllegalStateException() + it + } + y + y.equals(10) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.kt new file mode 100644 index 00000000000..b3dfae0c222 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.kt @@ -0,0 +1,123 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 52 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22175 + */ +fun case_1(x: String?) = x +fun case_1(x: Int?) = x +fun case_1() { + var x: Int? = 10 + x = null + case_1(x) +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Int?) = x +fun case_2(x: Nothing?) = x +fun case_2() { + var x: Int? = 10 + x = null + case_2(x) +} + +// TESTCASE NUMBER: 3 +fun case_3(x: String?) = x +fun case_3() { + var x: Int? = 10 + x = null + case_3(x) +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22175 + */ +fun String?.case_4() = this +fun Int?.case_4() = this +fun case_4() { + var x: Int? = 10 + x = null + x.case_4() +} + +// TESTCASE NUMBER: 5 +fun Int?.case_5() = this +fun Nothing?.case_5() = this +fun case_5() { + var x: Int? = 10 + x = null + x.case_5() +} + +// TESTCASE NUMBER: 6 +fun String?.case_6() = this +fun case_6() { + var x: Int? = 10 + x = null + x.case_6() +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22175 + */ +fun T.case_7() = this +fun T.case_7() = this +fun case_7() { + var x: Int? = 10 + x = null + x.case_7() +} + +// TESTCASE NUMBER: 8 +fun T.case_8() = this +fun T.case_8() = this +fun case_8() { + var x: Int? = 10 + x = null + x.case_8() +} + +// TESTCASE NUMBER: 9 +fun T.case_9() = this +fun case_9() { + var x: Int? = 10 + x = null + x.case_9() +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-22175 + */ +fun String> T?.case_10() = this +fun Int> T?.case_10() = this +fun case_10() { + var x: Int? = 10 + x = null + x.case_10() +} + +// TESTCASE NUMBER: 11 +fun String> T?.case_11() = this +fun case_11() { + var x: Int? = 10 + x = null + x.case_11() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.kt new file mode 100644 index 00000000000..fa865c4232b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.kt @@ -0,0 +1,99 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 53 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Int) = "" +fun case_1(x: Int?) = 10 +fun case_1() { + var x: Int? = 10 + if (x != null) { + val z = case_1(x) + z + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Int) = "" +fun case_2(x: Int?) = 10 +fun case_2() { + var x: Int? = 10 + var y = { x = null } + if (x != null) { + val z = case_2(x) + z + } +} + +// TESTCASE NUMBER: 3 +val case_3_prop: Int? + get() = 10 +fun case_3(x: Int) = "" +fun case_3(x: Int?) = 10 +fun case_3() { + if (case_3_prop != null) { + val z = case_3(case_3_prop) + z + } +} + +// TESTCASE NUMBER: 4 +class Case4 { + var x: Int? = 10 +} +fun case_4(x: Int) = "" +fun case_4(x: Int?) = 10 +fun case_4(y: Case4) { + if (y.x != null) { + val z = case_4(y.x) + z + } +} + +// TESTCASE NUMBER: 5 +open class Case5 { + open val x: Int? = 10 +} +fun case_5(x: Int) = "" +fun case_5(x: Int?) = 10 +fun case_5(y: Case4) { + if (y.x != null) { + val z = case_5(y.x) + z + } +} + +// TESTCASE NUMBER: 6 +class Case6 { + val x: Int? by lazy { 10 } +} +fun case_6(x: Int) = "" +fun case_6(x: Int?) = 10 +fun case_6(y: Case4) { + if (y.x != null) { + val z = case_6(y.x) + z + } +} + +// TESTCASE NUMBER: 7 +var case_7_prop: Int? + get() = 10 + set(value) {} +fun case_7(x: Int) = "" +fun case_7(x: Int?) = 10 +fun case_7() { + if (case_7_prop != null) { + val z = case_7(case_7_prop) + z + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.kt new file mode 100644 index 00000000000..c5e771de2d6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.kt @@ -0,0 +1,307 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 54 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_1() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + while (a is String) { + b = a + b + b.length + } + + b + b.length + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_2() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + while (true) { + b = a + b + b.length + } + + b + b.length + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_3() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + do { + b = a + b + b.length + } while (true) + + b + b.length + } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_4() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + do { + b = a + b + b.length + } while (false) + + b + b.length + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_5() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + for (i in 0..10) { + b = a + b + b.length + } + + b + b.length + } +} + +// TESTCASE NUMBER: 6 +fun case_6() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + if (a is String) { + b = a + b + b.length + } + + b + b.length + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + when (true) { + true -> b = a + } + + b + b.length + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_8() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + try { + b = a + b + b.length + } catch (e: Exception) { } + + b + b.length + } +} + +// TESTCASE NUMBER: 9 +fun case_9() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + try { + + } catch (e: Exception) { + b = a + b + b.length + } + + b + b.length + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + try { + b = a + b + b.length + } finally { + + } + + b + b.length + } +} + +// TESTCASE NUMBER: 11 +fun case_11() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + try { + + } finally { + b = a + b + b.length + } + + b + b.length + } +} + +/* + * TESTCASE NUMBER: 12 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_12() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + while (if (true) { b = a; true } else true) { + b + b.length + } + + b + b.length + } +} + +// TESTCASE NUMBER: 13 +fun case_13() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + a.plus(if (true) { b = a; true } else true) + + b + b.length + } +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7676 + */ +fun case_14() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + while (true) { + if (true) { b = a; } else 3 + b + b.length + } + } +} + +// TESTCASE NUMBER: 15 +fun case_15() { + var a: Any = 4 + if (a is String) { + var b = a + b + b.length + while (true) { + if (true) { b = a; } else { b = a; } + b + b.length + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.kt new file mode 100644 index 00000000000..81e4a51a49f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.kt @@ -0,0 +1,56 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 55 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-10662 + */ +fun case_1(x: Any) { + if (x is String) { + x!!.length + x + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-10662 + */ +fun case_2(x: Any?) { + if (x is String?) { + x!!.length + x + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-10662 + */ +fun case_3(x: Any) { + if (x is Map.Entry<*, *>) { + ")!>x!!.key + ")!>x + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-10662 + */ +fun case_4(x: Any?) { + if (x is Map.Entry<*, *>?) { + ")!>x!!.value + ")!>x + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.kt new file mode 100644 index 00000000000..678ec05567b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.kt @@ -0,0 +1,55 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 56 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Class?) { + if (x != null) (kotlin.Int) -> kotlin.Int>")!>x::fun_1 +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17386 + */ +fun case_2(x: Class?) { + val y = (kotlin.Int) -> kotlin.Int>?")!>if (x != null) x::fun_1 else null + (kotlin.Int) -> kotlin.Int>?")!>y +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17386 + */ +fun case_3(x: Class?) { + val y = (kotlin.Int) -> kotlin.Int>?")!>if (x != null) Class::fun_1 else null + (kotlin.Int) -> kotlin.Int>?")!>y +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-17386 + */ +fun case_4(x: Class?) { + val y = if (x != null) x::fun_1 else 10 + y +} + +/* + * TESTCASE NUMBER: 5 + * ISSUES: KT-17386 + */ +fun case_5(x: Class?) { + val y = if (x != null) Class::fun_1 else 10 + y +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.kt new file mode 100644 index 00000000000..e7305401a1e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.kt @@ -0,0 +1,141 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 57 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-20656 + */ +fun case_1(x: Any?) { + if (x is String) { + x + val y = if (true) Class::fun_1 else Class::fun_1 + x + val z: String = x + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-20656, KT-17386 + */ +fun case_2(x: Any?, b: Boolean?) { + x!! + x + val y = when (b) { + true -> Class::fun_1 + false -> Class::fun_2 + null -> Class::fun_3 + } + x + val z: Any = x +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-20656 + */ +fun case_3(x: Any?, b: Boolean?) { + x as Int + x + val y = when (b) { + else -> Class::fun_1 + } + x + val z: Int = x +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?, b: Boolean?) { + x as Int + x + if (b!!) { + val m = Class::fun_1 + } + x + val z: Int = x +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-20656 + */ +fun case_5(x: Any?, b: Class) { + x as Int + x + val y = if (true) b::fun_1 else b::fun_1 + x + val z: Int = x +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-20656 + */ +fun case_6(x: Any?, b: Class) { + x as Int + val z1 = x + x + val y = if (true) b::fun_1 else b::fun_1 + x + z1 + val z2: Int = z1 +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-20656 + */ +fun case_7_1() {} +fun case_7(x: Any?) { + if (x is String) { + x + val y = if (true) ::case_7_1 else ::case_7_1 + x + val z: String = x + } +} + +// TESTCASE NUMBER: 8 +fun case_8_1() {} +fun case_8(x: Any?) { + if (x is String) { + x + val m = try { + ::case_8_1 + } catch (e: Exception) { + ::case_8_1 + } + x + val z: String = x + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + if (x is String) { + x + val m = try { + Class::fun_1 + } finally { + Class::fun_1 + } + x + val z: String = x + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.kt new file mode 100644 index 00000000000..5c93af3a6c0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.kt @@ -0,0 +1,89 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 58 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18532 + */ +fun case_1() { + val x = In() + val y: In<*> + y = x + y.put(0) + val z: In<*> = x + z.put(0) +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18532 + */ +fun case_2() { + val x = Inv() + val y: Inv + y = x + y.put(0) + val z: Inv = x + z.put(0) +} + +// TESTCASE NUMBER: 3 +fun case_3() { + val x = Inv() + val y: Inv + y = x + y.put(0) + val z: Inv = x + z.put(0) +} + +// TESTCASE NUMBER: 4 +fun case_4() { + val x = In() + val y: In + y = x + y.put(0) + val z: In = x + z.put(0) +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18532 + */ +fun case_5() { + val x = Inv() + var y: Inv = Inv() + y = x + y.put(0) + val z: Inv = x + z.put(0) +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-18532 + */ +fun case_6() { + val x = Inv() + var y: Inv = Inv() + if (true) + y = x + y.put(0) + val z: Inv = x + z.put(0) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.kt new file mode 100644 index 00000000000..3c05da34bea --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.kt @@ -0,0 +1,215 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNUSED_VALUE +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 59 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_1() { + var x: Any? = null + if (x == null) return + do { + x + x = x.equals(10) + } while (x != null) +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_2() { + var x: Any? = null + if (x === null) return + do { + x + x = x.equals(10) + } while (x !== null) +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: Any? = null + while (x != null) { + x + x = x.equals(10) + } +} + +// TESTCASE NUMBER: 4 +fun case_4() { + var x: Any? = null + while (x !== null) { + x + x = x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_5() { + var x: Any? = null + if (x == null) return + do { + x + x = x.equals(10) + } while (x !== null) +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_6() { + var x: Any? = null + if (x === null) return + do { + x + x = x.equals(10) + } while (x != null) +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_7() { + var x: Any? = null + x ?: return + do { + x + x = x.equals(10) + } while (x !== null) +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_8() { + var x: Any? = null + if (x == null) throw Exception() + do { + x + x = x.equals(10) + } while (x != null) +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_9() { + var x: Any? = null + x ?: throw Exception() + do { + x + x = x.equals(10) + } while (x !== null) +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_10() { + var x: Any? = null + x as Any + do { + x + x = x.equals(10) + } while (x != null) +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_11() { + var x: Any? = null + x as? Any ?: null!! + do { + x + x = x.equals(10) + } while (x != null) +} + +/* + * TESTCASE NUMBER: 12 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_12() { + var x: Any? = null + if (x is Any) { + do { + x + x = x .equals(10) + } while (x != null) + } +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_13() { + var x: Any? = null + if (x != null) { + do { + x + x = x .equals(10) + } while (x != null) + } +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_14() { + var x: Any? = null + if (x == null) return + do { + x + x = x.equals(10) + } while (x is Any) +} + +/* + * TESTCASE NUMBER: 15 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-7508 + */ +fun case_15() { + var x: Any? = null + if (x is Any) { + do { + x + x = x .equals(10) + } while (x is Any) + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt new file mode 100644 index 00000000000..137eb3da727 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt @@ -0,0 +1,1401 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 6 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, enumClasses, interfaces, objects, typealiases, properties, functions + */ + +// FILE: other_types.kt + +package othertypes + +// TESTCASE NUMBER: 12, 48 +class EmptyClass12_48 {} + +// FILE: main.kt + +import othertypes.* + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + val y = null + if (x != y) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28159 + */ +fun case_2(x: Nothing?) { + val y = null + if (x !== y) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + val y = null + + if (Object.prop_1 == y) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Char?, y: Nothing?) { + if (x != y && true) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Unit? = null + val y: Nothing? = null + + if (x !== y) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: EmptyClass?, z: Nothing?) { + val y = true + + if (x != z && !y) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7(x: EmptyObject?) { + val y = null + + if (x != y || x != y) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: TypealiasNullableString) { + val y = null + + if (x !== y && x != y) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: TypealiasNullableString?, y: Nothing?) { + if (x === y) { + + } else if (false) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + val a = Class() + val b = null + + if (a.prop_4 === b || true) { + if (a.prop_4 != null) { + a.prop_4 + a.prop_4.equals(null) + a.prop_4.propT + a.prop_4.propAny + a.prop_4.propNullableT + a.prop_4.propNullableAny + a.prop_4.funT() + a.prop_4.funAny() + a.prop_4.funNullableT() + a.prop_4.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) { + val z = null + val u: TypealiasNullableString = null + val v = null + + if (x == z && x == v) { + + } else { + if (y != z) { + if (nullableStringProperty == z) { + if (u != z || u != v) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: TypealiasNullableString, y: TypealiasNullableString, z1: Nothing?, z2: Nothing?) = if (x == z1 || x == z2) "1" + else if (y === z1 && y == z2) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } else "-1" + +// TESTCASE NUMBER: 13 +fun case_13(x: EmptyClass12_48?, z: Nothing?) = + if (x == z || x === z && x == z) { + throw Exception() + } else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + +// TESTCASE NUMBER: 14 +class Case14 { + val x: TypealiasNullableString? + init { + x = TypealiasNullableString() + } +} + +fun case_14() { + val a = Case14() + val x = null + val y = implicitNullableNothingProperty + + if (a.x != x && a.x != y || a.x != y && a.x !== null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: TypealiasNullableString) { + val y = null + val z = if (x === null || y == x && x === y || null === x) "" else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 16 +fun case_16() { + val x: TypealiasNullableNothing = null + val y: Nothing? = null + + if (x !== y) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 17 +val case_17 = if (nullableIntProperty === implicitNullableNothingProperty) 0 else { + nullableIntProperty + nullableIntProperty.equals(null) + nullableIntProperty.propT + nullableIntProperty.propAny + nullableIntProperty.propNullableT + nullableIntProperty.propNullableAny + nullableIntProperty.funT() + nullableIntProperty.funAny() + nullableIntProperty.funNullableT() + nullableIntProperty.funNullableAny() +} + +//TESTCASE NUMBER: 18 +fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?, b: Boolean) { + val x = null + val y = null + + if (a != (if (b) x else y) || x !== a) { + a + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } +} + +// TESTCASE NUMBER: 19 +fun case_19(b: Boolean) { + val z = null + val a = if (b) { + object { + val B19 = if (b) { + object { + val C19 = if (b) { + object { + val D19 = if (b) { + object { + val x: Number? = 10 + } + } else z + } + } else z + } + } else z + } + } else z + + if (a != z && a.B19 !== z && a.B19.C19 != z && a.B19.C19.D19 != z && a.B19.C19.D19.x !== z) { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 20 +fun case_20(x: Boolean, y: Nothing?) { + val z = object { + val B19 = object { + val C19 = object { + val D19 = if (x) { + object {} + } else y + } + } + } + + if (z.B19.C19.D19 !== y) { + .B19..C19..D19. & case_20..B19..C19..D19.?")!>z.B19.C19.D19 + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>z.B19.C19.D19.equals(null) + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>z.B19.C19.D19.propT + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>z.B19.C19.D19.propAny + .B19..C19..D19. & case_20..B19..C19..D19.?")!>z.B19.C19.D19.propNullableT + .B19..C19..D19. & case_20..B19..C19..D19.?")!>z.B19.C19.D19.propNullableAny + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>z.B19.C19.D19.funT() + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>z.B19.C19.D19.funAny() + .B19..C19..D19. & case_20..B19..C19..D19.?")!>z.B19.C19.D19.funNullableT() + .B19..C19..D19. & case_20..B19..C19..D19.?")!>z.B19.C19.D19.funNullableAny() + } +} + +// TESTCASE NUMBER: 21 +fun case_21() { + if (EnumClassWithNullableProperty.A.prop_1 !== implicitNullableNothingProperty) { + EnumClassWithNullableProperty.A.prop_1 + EnumClassWithNullableProperty.A.prop_1.equals(null) + EnumClassWithNullableProperty.A.prop_1.propT + EnumClassWithNullableProperty.A.prop_1.propAny + EnumClassWithNullableProperty.A.prop_1.propNullableT + EnumClassWithNullableProperty.A.prop_1.propNullableAny + EnumClassWithNullableProperty.A.prop_1.funT() + EnumClassWithNullableProperty.A.prop_1.funAny() + EnumClassWithNullableProperty.A.prop_1.funNullableT() + EnumClassWithNullableProperty.A.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 22 +fun case_22(a: (() -> Unit)?) { + if (a != implicitNullableNothingProperty) { + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(null) + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propT + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propAny + kotlin.Unit)? & () -> kotlin.Unit")!>a.propNullableT + kotlin.Unit)? & () -> kotlin.Unit")!>a.propNullableAny + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funT() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funAny() + kotlin.Unit)? & () -> kotlin.Unit")!>a.funNullableT() + kotlin.Unit)? & () -> kotlin.Unit")!>a.funNullableAny() + } +} + +// TESTCASE NUMBER: 23 +fun case_23(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { + if (a != z && b !== z && b !== z) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (x != z || x !== implicitNullableNothingProperty) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 24 +fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) = + if (a !== z && b !== z) { + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a( kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b) + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(null) + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propT + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propAny + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.propNullableT + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.propNullableAny + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funT() + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funAny() + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.funNullableT() + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.funNullableAny() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.equals(null) + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.propT + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.propAny + kotlin.Unit)? & () -> kotlin.Unit")!>b.propNullableT + kotlin.Unit)? & () -> kotlin.Unit")!>b.propNullableAny + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.funT() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.funAny() + kotlin.Unit)? & () -> kotlin.Unit")!>b.funNullableT() + kotlin.Unit)? & () -> kotlin.Unit")!>b.funNullableAny() + } else z + +// TESTCASE NUMBER: 25 +fun case_25(b: Boolean, z: Nothing?) { + val x = { + if (b) object { + val a = 10 + } else z + } + + val y = if (b) x else z + + if (y !== z || y != implicitNullableNothingProperty) { + val z1 = .?")!> case_25..?)? & () -> case_25..?"), DEBUG_INFO_SMARTCAST!>y() + + if (z1 != z && implicitNullableNothingProperty !== z1) { + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.a + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.equals(null) + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.propT + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.propAny + . & case_25..?")!>z1.propNullableT + . & case_25..?")!>z1.propNullableAny + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.funT() + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z1.funAny() + . & case_25..?")!>z1.funNullableT() + . & case_25..?")!>z1.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 26 +fun case_26(a: ((Float) -> Int?)?, b: Float?) { + var z = null + + if (a != z == true && b != implicitNullableNothingProperty == true) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (x != implicitNullableNothingProperty == true || z !== x) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 27 +fun case_27(z: Nothing?) { + if (Object.prop_1 == z == true == true == true == true == true == true == true == true == true == true == true == true == true == true) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 28 +fun case_28(a: DeepObject.A.B.C.D.E.F.G.J?) = + if (a != implicitNullableNothingProperty == true == false == false == false == true == false == true == false == false == true == true) { + a.x + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } else -1 + +/* + * TESTCASE NUMBER: 29 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28328, KT-28329 + */ +fun case_29(x: Boolean) { + val v = null + val z = { + if (x) object { + val a = 10 + } else null + } + + val y = if (x) z else null + + if (false || false || false || false || y !== v) { + val t = .?")!>y() + + if (z !== t || false) { + .?")!>t.a + .?")!>t.equals(null) + .?")!>t.propT + .?")!>t.propAny + .?")!>t.propNullableT + .?")!>t.propNullableAny + .?")!>t.funT() + .?")!>t.funAny() + .?")!>t.funNullableT() + .?")!>t.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 30 +fun case_30(a: ((Float) -> Int?)?, b: Float?) { + if (implicitNullableNothingProperty != a == true && b != implicitNullableNothingProperty == true || false || false || false || false || false || false || false || false || false) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (false || implicitNullableNothingProperty != x == true) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 31 +fun case_31(z1: Boolean?, z: Nothing?) { + if (false || EnumClassWithNullableProperty.A.prop_1 != z && z1 !== z && z1) { + EnumClassWithNullableProperty.A.prop_1 + EnumClassWithNullableProperty.A.prop_1.equals(null) + EnumClassWithNullableProperty.A.prop_1.propT + EnumClassWithNullableProperty.A.prop_1.propAny + EnumClassWithNullableProperty.A.prop_1.propNullableT + EnumClassWithNullableProperty.A.prop_1.propNullableAny + EnumClassWithNullableProperty.A.prop_1.funT() + EnumClassWithNullableProperty.A.prop_1.funAny() + EnumClassWithNullableProperty.A.prop_1.funNullableT() + EnumClassWithNullableProperty.A.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 32 +fun case_32(a: DeepObject.A.B.C.D.E.F.G.J?) = + if (a == implicitNullableNothingProperty == true == false == false == false == true == false == true == false == false == true == true && true) { + -1 + } else { + a.x + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } + +// TESTCASE NUMBER: 33 +fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) { + var z = null + + if (true && a == z == true || b == null == true) { + + } else { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (x == z == true && x === z || (c != z && !c)) { + + } else { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 34 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_34(z1: Boolean?) { + var z = null + + if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && EnumClassWithNullableProperty.A.prop_1 !== null && EnumClassWithNullableProperty.A.prop_1 !== z || z1 != implicitNullableNothingProperty || z1!! && true && true) { + + } else { + EnumClassWithNullableProperty.A.prop_1 + EnumClassWithNullableProperty.A.prop_1.equals(null) + EnumClassWithNullableProperty.A.prop_1.propT + EnumClassWithNullableProperty.A.prop_1.propAny + EnumClassWithNullableProperty.A.prop_1.propNullableT + EnumClassWithNullableProperty.A.prop_1.propNullableAny + EnumClassWithNullableProperty.A.prop_1.funT() + EnumClassWithNullableProperty.A.prop_1.funAny() + EnumClassWithNullableProperty.A.prop_1.funNullableT() + EnumClassWithNullableProperty.A.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 35 +fun case_35(a: DeepObject.A.B.C.D.E.F.G.J?) { + val itest = false + + if (true && a != implicitNullableNothingProperty && a !== implicitNullableNothingProperty || itest || !itest || true || !true) { + + } else { + a + a.hashCode() + } +} + +// TESTCASE NUMBER: 36 +fun case_36(x: Any) { + var z = null + + if (x == z) { + x + x.java + } +} + +// TESTCASE NUMBER: 37 +fun case_37(x: Nothing?, y: Nothing?) { + if (x == y) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 38 +fun case_38() { + val z = null + + if (Object.prop_2 != z) + else { + Object.prop_2 + Object.prop_2.java + } +} + +// TESTCASE NUMBER: 39 +fun case_39(x: Char?) { + if (x == implicitNullableNothingProperty && true) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 40 +fun case_40() { + val x: Unit? = null + var z = null + + if (x == implicitNullableNothingProperty || z === x) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 41 +fun case_41(x: EmptyClass?, z: Nothing?) { + val y = true + + if (x === z && !y) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 42 +fun case_42() { + if (EmptyObject == nullableNothingProperty || EmptyObject === nullableNothingProperty) { + EmptyObject + EmptyObject.equals(null) + EmptyObject.propT + EmptyObject.propAny + EmptyObject.propNullableT + EmptyObject.propNullableAny + EmptyObject.funT() + EmptyObject.funAny() + EmptyObject.funNullableT() + EmptyObject.funNullableAny() + } +} + +// TESTCASE NUMBER: 43 +fun case_43(x: TypealiasNullableString) { + val z = null + + if (x == z && x == z) { + x + x.hashCode() + } +} + +/* + * TESTCASE NUMBER: 44 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_44(x: TypealiasNullableString?, z1: Nothing?) { + if (true && true && true && true && x !== z1) { + + } else if (false) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 45 +fun case_45() { + val a = Class() + var z: Nothing? = null + + if (a.prop_4 != z || true) { + if (a.prop_4 == null) { + a.prop_4 + a.prop_4.hashCode() + } + } +} + +// TESTCASE NUMBER: 46 +fun case_46(x: TypealiasNullableString?, y: TypealiasNullableString) { + val t: TypealiasNullableString = null + var z: Nothing? = null + + if (x != nullableNothingProperty) { + + } else { + if (y === nullableNothingProperty) { + if (z != nullableStringProperty) { + if (z === t || t == nullableNothingProperty) { + x + x.hashCode() + } + } + } + } +} + +/* + * TESTCASE NUMBER: 47 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28328 + */ +fun case_47(x: TypealiasNullableString, y: TypealiasNullableString, z: Nothing?) = if (x !== z && true && true && true) "1" + else if (y != z) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } else "-1" + +// TESTCASE NUMBER: 48 +fun case_48(x: EmptyClass12_48?, z: Nothing?) = + if (x != z && true) { + throw Exception() + } else { + x + x.hashCode() + } + +// TESTCASE NUMBER: 49 +class Case49 { + val x: TypealiasNullableString? + init { + x = TypealiasNullableString() + } +} + +fun case_49() { + val a = Case49() + var z = null + + if (a.x === z) { + a.x + a.x.hashCode() + } +} + +// TESTCASE NUMBER: 50 +fun case_50(x: TypealiasNullableString) { + val z1 = null + val z2 = null + val t = if (x != z1 && z2 !== x) "" else { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 51 +fun case_51() { + val x: TypealiasNullableNothing = null + val z: Nothing? = null + + if (x === z || z == x && x == z || false || false || false) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 52 +val case_52 = if (nullableIntProperty !== nullableNothingProperty && nullableNothingProperty != nullableIntProperty) 0 else { + nullableIntProperty + nullableIntProperty.hashCode() +} + +//TESTCASE NUMBER: 53 +fun case_53(a: DeepObject.A.B.C.D.E.F.G.J?) { + if (a == DeepObject.prop_2) { + a + a.hashCode() + } +} + +// TESTCASE NUMBER: 54 +fun case_54(b: Boolean) { + val a = if (b) { + object { + var z = null + val B54 = if (b) { + object { + val C54 = if (b) { + object { + val D54 = if (b) { + object { + val x: Number? = 10 + } + } else null + } + } else null + } + } else null + } + } else null + + val z = null + + if (a != z && a.B54 !== a.z && a.B54.C54 != a.z && a.B54.C54.D54 != a.z && a.B54.C54.D54.x === a.z) { + a.B54.C54.D54.x + a.B54.C54.D54.x.hashCode() + } +} + +// TESTCASE NUMBER: 55 +fun case_55(b: Boolean) { + val a = object { + val B19 = object { + val C19 = object { + var z = null + val D19 = if (b) { + object {} + } else null + } + } + } + + if (a.B19.C19.D19 === a.B19.C19.z) { + .B19..C19..D19.? & kotlin.Nothing?")!>a.B19.C19.D19 + } +} + +// TESTCASE NUMBER: 56 +fun case_56() { + if (EnumClassWithNullableProperty.A.prop_1 == implicitNullableNothingProperty) { + EnumClassWithNullableProperty.A.prop_1 + EnumClassWithNullableProperty.A.prop_1.hashCode() + } +} + +// TESTCASE NUMBER: 57 +fun case_57(a: (() -> Unit)) { + var z = null + + if (a == z) { + kotlin.Unit & kotlin.Nothing")!>a + kotlin.Unit & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>a.java + } +} + +// TESTCASE NUMBER: 58 +fun case_58(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { + if (a === z && b == z || z == a && z === b) { + kotlin.Int?)? & kotlin.Nothing?")!>a + b + if (a != z) { + kotlin.Int?)? & (kotlin.Float) -> kotlin.Int? & kotlin.Nothing")!>a + kotlin.Int?)? & kotlin.Nothing"), DEBUG_INFO_SMARTCAST!>a.java + } + } +} + +/* + * TESTCASE NUMBER: 59 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_59(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?, z: Nothing?) { + if (false || false || a == z && b === z) { + kotlin.Unit) -> kotlin.Unit)?")!>a + kotlin.Unit)?")!>b + kotlin.Unit) -> kotlin.Unit)?")!>a.equals(null) + kotlin.Unit) -> kotlin.Unit)?")!>a.propT + kotlin.Unit) -> kotlin.Unit)?")!>a.propAny + kotlin.Unit) -> kotlin.Unit)?")!>a.propNullableT + kotlin.Unit) -> kotlin.Unit)?")!>a.propNullableAny + kotlin.Unit) -> kotlin.Unit)?")!>a.funT() + kotlin.Unit) -> kotlin.Unit)?")!>a.funAny() + kotlin.Unit) -> kotlin.Unit)?")!>a.funNullableT() + kotlin.Unit) -> kotlin.Unit)?")!>a.funNullableAny() + kotlin.Unit)?")!>b.equals(null) + kotlin.Unit)?")!>b.propT + kotlin.Unit)?")!>b.propAny + kotlin.Unit)?")!>b.propNullableT + kotlin.Unit)?")!>b.propNullableAny + kotlin.Unit)?")!>b.funT() + kotlin.Unit)?")!>b.funAny() + kotlin.Unit)?")!>b.funNullableT() + kotlin.Unit)?")!>b.funNullableAny() + } +} + +// TESTCASE NUMBER: 60 +fun case_60(b: Boolean) { + val x = { + if (b) object { + val a = 10 + } else nullableNothingProperty + } + + val y = if (b) x else nullableNothingProperty + + if (y != nullableNothingProperty) { + val z = .?")!> case_60..?)? & () -> case_60..?"), DEBUG_INFO_SMARTCAST!>y() + + if (z == nullableNothingProperty) { + .? & kotlin.Nothing?")!>z + } + } +} + +// TESTCASE NUMBER: 61 +fun case_61(x: Any?) { + if (x is Number?) { + if (x !== implicitNullableNothingProperty) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 62 +fun case_62(x: Any?) { + var z = null + if (x is Number? && x is Int? && x != z) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 63 +fun case_63(x: Any?, b: Boolean) { + val z1 = null + val z2 = null + val z3 = null + + if (x is Number?) { + if (x !== when (b) { true -> z1; false -> z2; else -> z3 }) { + if (x is Int?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 64 +fun case_64(x: Any?) { + if (x != try {implicitNullableNothingProperty} finally {}) { + if (x is Number) { + if (x is Int?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 65 +fun case_65(x: Any?, z: Nothing?) { + if (x is ClassLevel1?) { + if (x is ClassLevel2?) { + if (x is ClassLevel3?) { + if (x is ClassLevel4?) { + if (x is ClassLevel5?) { + if (x != z) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 66 +fun case_66(x: Any?, z1: Nothing?, z2: Nothing?, b: Boolean) { + if (x is ClassLevel1?) { + if (x is ClassLevel2?) { + if (x is ClassLevel3?) { + if (x != if (b) { z1 } else { z2 } && x is ClassLevel4?) { + if (x is ClassLevel5?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } + } + } +} + +// TESTCASE NUMBER: 67 +fun case_67(x: Any?) { + var z = null + + if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { + if (x is ClassLevel4? && x != (fun (): Nothing? { return z })() && x is ClassLevel5?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 68 +fun case_68(x: Any?, z: Nothing?) { + if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { + if (x is ClassLevel4? && x != (fun (): Nothing? { return z })() && x is ClassLevel5?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 69 +fun case_69(x: Any?, z: Nothing?) { + if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3? && x is ClassLevel4? && x != try { z } catch (e: Exception) { z } && x is ClassLevel5?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 70 +fun case_70(x: Any?) { + if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { + if (x is ClassLevel4?) { + + } else if (x is ClassLevel5? && x != nullableNothingProperty || x != implicitNullableNothingProperty) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } else if (x is ClassLevel4? && x !== nullableNothingProperty && x is ClassLevel5?) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 71 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_71(t: Any?) { + val z1 = null + var z2 = z1 + + if (t is Interface1?) { + if (t is Interface2?) { + if (t != z2) { + t + t.itest1() + t.itest2() + t.itest() + + t.let { it.itest1(); it.itest2() } + } + } + } +} + +/* + * TESTCASE NUMBER: 72 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362, KT-27032 + */ +fun case_72(t: Any?, z1: Nothing?) { + var z2 = null + + if (t is Interface1? && t != z1 ?: z2 && t is Interface2?) { + t + t.itest1() + t.itest2() + t.itest() + + t.let { it.itest1(); it.itest2() } + } +} + +/* + * TESTCASE NUMBER: 73 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_73(t: Any?) { + val `null` = null + + if (t is Interface2?) { + if (t is ClassLevel1?) { + if (t is ClassLevel2? && t is Interface1?) { + if (t !is Interface3?) {} else if (false) { + if (t != `null`) { + t.itest2() + t.itest1() + t.itest() + t.test1() + t.test2() + t + } + } + } + } + } +} + +/* + * TESTCASE NUMBER: 74 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_74(t: Any?) { + if (t is Interface2?) { + if (t is ClassLevel1?) { + if (t == implicitNullableNothingProperty || t === implicitNullableNothingProperty || t !is Interface1?) else { + if (t is ClassLevel2?) { + if (t is Interface3?) { + t.itest2() + t.itest1() + t.itest() + t.test1() + t.test2() + t + } + } + } + } + } +} + +/* + * TESTCASE NUMBER: 75 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_75(t: Any?, z: Nothing?) { + if (t !is ClassLevel2? || t !is ClassLevel1?) else { + if (t === ((((((z)))))) || t !is Interface1?) else { + if (t !is Interface2? || t !is Interface3?) {} else { + t.itest2() + t.itest1() + t.itest() + t.test1() + t.test2() + t + } + } + } +} + +// TESTCASE NUMBER: 76 +fun case_76(a: Any?, b: Int = if (a !is Number? === true || a !is Int? == true || a != null == false == true) 0 else a) { + a + b + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.kt new file mode 100644 index 00000000000..9bdd6d29c89 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.kt @@ -0,0 +1,25 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 60 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1() { + var x: String? = null + + outer@ while (x != null) { + inner@ do { + x = null + } while (x == null) + x + x.length + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.kt new file mode 100644 index 00000000000..b8cd4467c37 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.kt @@ -0,0 +1,173 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 61 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +class Case1 { + init { + var y: String? = "xyz" + if (y != null) { + y + y.length + } + } + constructor() +} + +// TESTCASE NUMBER: 2 +class Case2 { + init { + var y: String? = "xyz" + if (y != null) { + y + y.length + } + } +} + +// TESTCASE NUMBER: 3 +class Case3 { + init { + var y: String? = "xyz" + if (y != null) { + y + y.length + } + } + init { } +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +class Case4 { + init { + var y: String? = "xyz" + if (y != null) { + y + y.length + } + } + constructor(y: Int?) { + println(y) + } +} + +// TESTCASE NUMBER: 5 +class Case5() { + init { + var y: String? = "xyz" + if (y != null) { + y + y.length + } + } + constructor(y: Int?) : this() { + println(y) + } +} + +// TESTCASE NUMBER: 6 +class Case6() { + init { + var y: String? = "xyz" + if (y != null) { + y + y.length + } + } +} + +// TESTCASE NUMBER: 7 +class Case7() { + init { + var y: String? = "xyz" + if (y != null) { + y + y.length + } + } + constructor(y: Int?) : this() { + println(y) + } + constructor(y: Int?, z: Int?) : this() { + println(y) + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +class Case8 { + init { + var y: String? = "xyz" + y!! + y + y.length + } + constructor() +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +class Case9 { + init { + var y: String? = "xyz" + if (y == null) throw Exception() + y + y.length + } + constructor() +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +class Case10 { + init { + var y: String? = "xyz" + y ?: throw Exception() + y + y.length + } + constructor() +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +val case_12: Nothing? get() = null +class Case11 { + init { + var y: String? = "xyz" + if (y == case_12) + throw Exception() + y + y.length + } + constructor() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/62.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/62.kt new file mode 100644 index 00000000000..93fbf538adc --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/62.kt @@ -0,0 +1,463 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 62 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_1(x: Any) { + x as Boolean + val y = when(x) { + true -> "true" + false -> "false" + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_2(x: Any) { + x as Boolean? + val y = when(x) { + true -> "true" + false -> "false" + null -> "false" + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_3(x: Any?) { + x as Boolean? + val y = when(x) { + true -> "true" + false -> "false" + null -> "false" + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?): String { + x as Boolean + return when(x) { + true -> "true" + false -> "false" + } +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_5(x: Any): String { + x as Boolean? + return when(x) { + true -> "true" + false -> "false" + } +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_6(x: Any) { + if (x is Boolean) { + val y = when(x) { + true -> "true" + false -> "false" + } + } +} + +/* + * TESTCASE NUMBER: 7 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_7(x: Any) { + if (x is Boolean?) { + val y = when(x) { + true -> "true" + false -> "false" + null -> "false" + } + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_8(x: Any?) { + val y: Any + when (x) { + is Boolean? -> y = when(x) { + true -> "true" + false -> "false" + null -> "false" + } + else -> y = Any() + } + +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?): String { + if (x is Boolean) { + return when (x) { + true -> "true" + false -> "false" + } + } + return "" +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17694 + */ +fun case_10(x: Any): String { + if (x is Boolean?) { + return when(x) { + true -> "true" + false -> "false" + } + } + return "" +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30903 + */ +fun case_11(x: Any?): String? { + if (x is Nothing?) { + return when(x) { + null -> null + } + } + return "" +} + +/* + * TESTCASE NUMBER: 12 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30903 + */ +fun case_12(x: Any?): String? { + if (x == null) { + return when(x) { + null -> null + } + } + return "" +} + +/* + * TESTCASE NUMBER: 13 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30903 + */ +fun case_13(x: Any?): String? { + if (x === null) { + return when(x) { + null -> null + } + } + return "" +} + +/* + * TESTCASE NUMBER: 14 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30903 + */ +fun case_14(x: Any?): String? { + x as Nothing? + return when(x) { + null -> null + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: Any) { + x as EnumClass + val y = when(x) { + EnumClass.NORTH -> 1 + EnumClass.SOUTH -> 2 + EnumClass.WEST -> 3 + EnumClass.EAST -> 4 + } +} + +// TESTCASE NUMBER: 16 +fun case_16(x: Any) { + if (x is EnumClass?) { + val y = when(x) { + EnumClass.NORTH -> 1 + EnumClass.SOUTH -> 2 + EnumClass.WEST -> 3 + EnumClass.EAST -> 4 + null -> 5 + } + } +} + +// TESTCASE NUMBER: 17 +fun case_17(x: Any?) { + x as EnumClass? + val y = when(x) { + EnumClass.NORTH -> 1 + EnumClass.SOUTH -> 2 + EnumClass.WEST -> 3 + EnumClass.EAST -> 4 + null -> 5 + } +} + +// TESTCASE NUMBER: 18 +fun case_18(x: EnumClass?): Int { + x!! + return when(x) { + EnumClass.NORTH -> 1 + EnumClass.SOUTH -> 2 + EnumClass.WEST -> 3 + EnumClass.EAST -> 4 + } +} + +// TESTCASE NUMBER: 19 +fun case_19(x: Any): Int { + if (x is EnumClass?) { + return when(x) { + EnumClass.NORTH -> 1 + EnumClass.SOUTH -> 2 + EnumClass.WEST -> 3 + EnumClass.EAST -> 4 + null -> 5 + } + } + return 0 +} + +// TESTCASE NUMBER: 20 +fun case_20(x: Any?) { + x as EnumClass + val y = when(x) { + EnumClass.NORTH -> 1 + EnumClass.SOUTH -> 2 + EnumClass.WEST -> 3 + EnumClass.EAST -> 4 + } +} + +// TESTCASE NUMBER: 21 +fun case_21(x: EnumClass?): Int { + if (x !== null) { + return when(x) { + EnumClass.NORTH -> 1 + EnumClass.SOUTH -> 2 + EnumClass.WEST -> 3 + EnumClass.EAST -> 4 + } + } + return 0 +} + +// TESTCASE NUMBER: 22 +fun case_22(x: Boolean?) { + x!! + val y = when(x) { + true -> "true" + false -> "false" + } +} + +// TESTCASE NUMBER: 23 +fun case_23(x: Any?) { + x as Boolean? + if (x != null) { + val y = when(x) { + true -> "true" + false -> "false" + } + } +} + +// TESTCASE NUMBER: 24 +fun case_24(x: Any) { + x as SealedClass + val y = when(x) { + is SealedChild1 -> 1 + is SealedChild2 -> 2 + is SealedChild3 -> 3 + } +} + +// TESTCASE NUMBER: 25 +fun case_25(x: Any) { + if (x is SealedClass?) { + val y = when(x) { + is SealedChild1 -> 1 + is SealedChild2 -> 2 + is SealedChild3 -> 3 + null -> 5 + } + } +} + +// TESTCASE NUMBER: 26 +fun case_26(x: Any?) { + x as SealedClass? + val y = when(x) { + is SealedChild1 -> 1 + is SealedChild2 -> 2 + is SealedChild3 -> 3 + null -> 5 + } +} + +// TESTCASE NUMBER: 27 +fun case_27(x: SealedClass?): Int { + x!! + return when(x) { + is SealedChild1 -> 1 + is SealedChild2 -> 2 + is SealedChild3 -> 3 + } +} + +// TESTCASE NUMBER: 28 +fun case_28(x: Any): Int { + if (x is SealedClass?) { + return when(x) { + is SealedChild1 -> 1 + is SealedChild2 -> 2 + is SealedChild3 -> 3 + null -> 5 + } + } + return 0 +} + +// TESTCASE NUMBER: 29 +fun case_29(x: Any?) { + x as SealedClass + val y = when(x) { + is SealedChild1 -> 1 + is SealedChild2 -> 2 + is SealedChild3 -> 3 + } +} + +// TESTCASE NUMBER: 30 +fun case_30(x: SealedClass?): Int { + if (x !== null) { + return when(x) { + is SealedChild1 -> 1 + is SealedChild2 -> 2 + is SealedChild3 -> 3 + } + } + return 0 +} + +// TESTCASE NUMBER: 31 +fun case_31(x: Any) { + x as SealedClassWithObjects + val y = when(x) { + SealedWithObjectsChild1 -> 1 + SealedWithObjectsChild2 -> 2 + SealedWithObjectsChild3 -> 3 + } +} + +// TESTCASE NUMBER: 32 +fun case_32(x: Any) { + if (x is SealedClassWithObjects?) { + val y = when(x) { + SealedWithObjectsChild1 -> 1 + SealedWithObjectsChild2 -> 2 + SealedWithObjectsChild3 -> 3 + null -> 5 + } + } +} + +// TESTCASE NUMBER: 33 +fun case_33(x: Any?) { + x as SealedClassWithObjects? + val y = when(x) { + SealedWithObjectsChild1 -> 1 + SealedWithObjectsChild2 -> 2 + SealedWithObjectsChild3 -> 3 + null -> 5 + } +} + +// TESTCASE NUMBER: 34 +fun case_34(x: SealedClassWithObjects?): Int { + x!! + return when(x) { + SealedWithObjectsChild1 -> 1 + SealedWithObjectsChild2 -> 2 + SealedWithObjectsChild3 -> 3 + } +} + +// TESTCASE NUMBER: 35 +fun case_35(x: Any): Int { + if (x is SealedClassWithObjects?) { + return when(x) { + SealedWithObjectsChild1 -> 1 + SealedWithObjectsChild2 -> 2 + SealedWithObjectsChild3 -> 3 + null -> 5 + } + } + return 0 +} + +// TESTCASE NUMBER: 36 +fun case_36(x: Any?) { + x as SealedClassWithObjects + val y = when(x) { + SealedWithObjectsChild1 -> 1 + SealedWithObjectsChild2 -> 2 + SealedWithObjectsChild3 -> 3 + } +} + +// TESTCASE NUMBER: 37 +fun case_37(x: SealedClassWithObjects?): Int { + if (x !== null) { + return when(x) { + SealedWithObjectsChild1 -> 1 + SealedWithObjectsChild2 -> 2 + SealedWithObjectsChild3 -> 3 + } + } + return 0 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.kt new file mode 100644 index 00000000000..4ef11c09121 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.kt @@ -0,0 +1,81 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 63 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24901 + */ +fun case_1(x: String?) { + when { + x == null -> return + } + x + x.length +} + +// TESTCASE NUMBER: 2 +fun case_2(x: String?) { + when { + x == null -> return + else -> println(1) + } + x + x.length +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24901 + */ +fun case_3(x: String?) { + when (x) { + null -> return + } + x + x.length +} + +// TESTCASE NUMBER: 4 +fun case_4(x: String?) { + when (x) { + null -> return + else -> println(1) + } + x + x.length +} + +// TESTCASE NUMBER: 5 +fun case_5(x: String?) { + when (x) { + null -> throw Exception() + else -> println(1) + } + x + x.length +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-24901 + */ +fun case_6(x: String?) { + when (x) { + null -> throw Exception() + } + x + x.length +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.kt new file mode 100644 index 00000000000..b7c696bc96b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.kt @@ -0,0 +1,105 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 64 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-16373 + */ +class Case1 { + fun getT(): T = TODO() + fun getTN(): T? = null + + fun get(): T { + var x = getTN() + if (x == null) { + x = getT() + } + x + return x + } +} + +// TESTCASE NUMBER: 2 +class Case2 { + fun getInt(): Int = 10 + fun getIntN(): Int? = null + + fun get(): Int { + var x = getIntN() + if (x == null) { + x = getInt() + } + x + x.equals(10) + return x + } +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-16373 + */ +class Case3 { + fun getT(): T = TODO() + fun getTN(): T? = null + + fun get(): T { + var x = getTN() + x = x ?: getT() + x + return x + } +} + +// TESTCASE NUMBER: 4 +class Case4 { + fun getInt(): Int = 10 + fun getIntN(): Int? = null + + fun get(): Int { + var x = getIntN() + x = x ?: getInt() + x + x.equals(10) + return x + } +} + +// TESTCASE NUMBER: 5 +class Case5 { + fun getT(): T = TODO() + fun getTN(): T? = null + + fun get(): T { + var x = getTN() + x = if (x == null) getT() else x + x + return x + } +} + +// TESTCASE NUMBER: 6 +class Case6 { + fun getInt(): Int = 10 + fun getIntN(): Int? = null + + fun get(): Int { + var x = getIntN() + x = if (x == null) getInt() else x + x + x.equals(10) + return x + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.kt new file mode 100644 index 00000000000..29ff942585e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.kt @@ -0,0 +1,120 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 65 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Class) { + if (x.prop_13 !is String) return + x.prop_13 + x.prop_13.length +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any?) { + if (x !is String) return + x + x.length +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Class) { + if (x.prop_13 !is String) throw Exception() + x.prop_13 + x.prop_13.length +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?) { + if (x !is String) throw Exception() + x + x.length +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Class) { + if (x.prop_13 !is String?) throw Exception() + x.prop_13 + x.prop_13?.length +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (x !is String?) throw Exception() + x + x?.length +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any?) { + if (x !is Pair<*, *>) throw Exception() + ")!>x + "), DEBUG_INFO_SMARTCAST!>x.first +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (x !is Pair<*, *>?) return + ?")!>x + ?"), DEBUG_INFO_SMARTCAST!>x?.first +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + when (x) { + !is Pair<*, *> -> throw Exception() + else -> { + ")!>x + "), DEBUG_INFO_SMARTCAST!>x.first + } + } + ")!>x + "), DEBUG_INFO_SMARTCAST!>x.first +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + when (x) { + !is Pair<*, *>? -> return + else -> { + ?")!>x + ?"), DEBUG_INFO_SMARTCAST!>x?.first + } + } + ?")!>x + ?"), DEBUG_INFO_SMARTCAST!>x?.first +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + when { + x !is Pair<*, *> -> throw Exception() + else -> { + ")!>x + "), DEBUG_INFO_SMARTCAST!>x.first + } + } + ")!>x + "), DEBUG_INFO_SMARTCAST!>x.first +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Any?) { + when { + x !is Pair<*, *>? -> return + else -> { + ?")!>x + ?"), DEBUG_INFO_SMARTCAST!>x?.first + } + } + ?")!>x + ?"), DEBUG_INFO_SMARTCAST!>x?.first +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.kt new file mode 100644 index 00000000000..6493bfa4165 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.kt @@ -0,0 +1,97 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 66 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-31053 + */ +fun case_1(x: Any?) { + if (x !is Nothing?) { + x + x.equals(10) + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-31053 + */ +fun case_2(x: Pair<*, *>?) { + if (x is Nothing?) return + ?")!>x + ?")!>x.equals(10) +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-31053 + */ +fun case_3(x: Any?) { + if (x is Nothing?) throw Exception() + x + x.equals(10) +} + +/* + * TESTCASE NUMBER: 4 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-31053 + */ +fun case_4(x: Pair<*, *>?) { + when (x) { + is Nothing? -> return + else -> { + ?")!>x + ?")!>x.equals(10) + } + } + ?")!>x + ?")!>x.equals(10) +} + +/* + * TESTCASE NUMBER: 5 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-31053 + */ +fun case_5(x: Pair<*, *>?) { + when (x) { + !is Nothing? -> { + ?")!>x + ?")!>x.equals(10) + } + else -> return + } + ?")!>x + ?")!>x.equals(10) +} + +/* + * TESTCASE NUMBER: 6 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-31053 + */ +fun case_6(x: Any?) { + when (x) { + is Nothing? -> return + is Any? -> { + x + x.equals(10) + } + } + x + x.equals(10) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.kt new file mode 100644 index 00000000000..24364cd4517 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.kt @@ -0,0 +1,49 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 67 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + when (x) { + is Any -> { + x + x.equals(10) + } + else -> return + } + x + x.equals(10) +} + +// TESTCASE NUMBER: 2 +inline fun case_2(x: Any?) { + when (x) { + is T -> { + x + x.equals(10) + } + else -> return + } + x + x.equals(10) +} + +// TESTCASE NUMBER: 3 +inline fun case_3(x: Any?) { + if (x is T) { + x + x.equals(10) + } else throw Exception() + + x + x.equals(10) +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt new file mode 100644 index 00000000000..41d6499ef27 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt @@ -0,0 +1,76 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 68 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29083 + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x!! is Int) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any?) { + (x as Nothing?)!! + x + x.inv() +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x as Number? is Int) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?) { + if (x as Class? is Class) { + x + x.prop_1 + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Any?) { + if (x as Nothing? is Nothing) { + x + x.inv() + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + (x as String?)!! + x + x.length +} + +// TESTCASE NUMBER: 7 +fun case_7(x: Any?) { + if (x as String? != null) { + x + x.length + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (x as String? == null) { + x + x.length + } +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.kt new file mode 100644 index 00000000000..ece9ea18122 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.kt @@ -0,0 +1,53 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 69 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-29083 + */ + +// TESTCASE NUMBER: 1 +fun test1(x: ClassLevel1?) { + if (x!! is ClassLevel2) { + x + x.test2() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Any?) { + (x as ClassLevel1?)!! + x + x.test1() +} + +// TESTCASE NUMBER: 3 +fun case_3(x: Any?) { + if (x as ClassLevel1? is ClassLevel1) { + x + x.test1() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Any?) { + if ((x as Class).prop_8 != null) { + x + x.prop_8.prop_8 + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: Class) { + if (x!!.prop_8 != null) { + x + x.prop_8.prop_8 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt new file mode 100644 index 00000000000..51205113d37 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt @@ -0,0 +1,569 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 7 + * DESCRIPTION: Raw data flow analysis test + * UNEXPECTED BEHAVIOUR + * HELPERS: classes, enumClasses, objects, typealiases, properties, functions + */ + +// FILE: other_package.kt + +package orherpackage + +// TESTCASE NUMBER: 13 +class EmptyClass13 {} + +// TESTCASE NUMBER: 14 +typealias TypealiasString14 = String? + +// FILE: main.kt + +import orherpackage.* + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x != null || x != null || x != null || x != null || x != null || x != null || x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28159 + */ +fun case_2(x: Nothing?) { + if (x !== null && x !== null) { + x + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + if (Object.prop_1 == null && Object.prop_1 == null) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Char?) { + if (x != null && true || x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Unit? = null + + if (x !== null || x !== null && x !== null || x !== null && x !== null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Class?) { + val y = true + + if (((false || x != null || false) && !y) || x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + val x: EmptyObject? = null + if (x != null || x != null || x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: TypealiasString) { + if (x !== null && x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 9 +fun case_9(x: TypealiasNullableString?) { + if (x === null && x === null || x === null) { + + } else if (x === null || x === null) { + } else if (false) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + val a = Class() + + if (a.prop_4 === null || a.prop_4 === null || true) { + if (a.prop_4 != null) { + a.prop_4 + a.prop_4.equals(null) + a.prop_4.propT + a.prop_4.propAny + a.prop_4.propNullableT + a.prop_4.propNullableAny + a.prop_4.funT() + a.prop_4.funAny() + a.prop_4.funNullableT() + a.prop_4.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) { + val t: TypealiasNullableString = null + + if (x == null) { + + } else { + if (x != null) { + if (y != null || y != null) { + if (stringProperty == null && nullableNothingProperty == null) { + if (t != null || t != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } + } + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = if (x == null) "1" + else if (y === null || y === null) { + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x + } else "-1" + +// TESTCASE NUMBER: 13 +fun case_13(x: orherpackage.EmptyClass13?, y: Nothing?) = + if (x == null || x === y) { + throw Exception() + } else { + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x + } + +// TESTCASE NUMBER: 14 +fun case_14() { + val a = Class() + if (a.prop_6 != a.prop_7) { + a.prop_6 + a.prop_6.equals(null) + a.prop_6.propT + a.prop_6.propAny + a.prop_6.propNullableT + a.prop_6.propNullableAny + a.prop_6.funT() + a.prop_6.funAny() + a.prop_6.funNullableT() + a.prop_6.funNullableAny() + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: TypealiasString?) { + var y = null + val t = if (x === null || x == y && x === y) "" else { + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x + } +} + +// TESTCASE NUMBER: 16 +fun case_16() { + val x: TypealiasNothing? = null + val y: Nothing? = null + + if (x != null || x !== null || x != y) { + x + x.hashCode() + } +} + +// TESTCASE NUMBER: 17 +val case_17 = if (nullableIntProperty == null || nullableNothingProperty === nullableIntProperty) 0 else { + nullableIntProperty.equals(null) + nullableIntProperty.propT + nullableIntProperty.propAny + nullableIntProperty.propNullableT + nullableIntProperty.propNullableAny + nullableIntProperty.funT() + nullableIntProperty.funAny() + nullableIntProperty.funNullableT() + nullableIntProperty.funNullableAny() + nullableIntProperty +} + +/* + * TESTCASE NUMBER: 18 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28328 + */ +fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?, b: Nothing?) { + if (a != null || b !== a || false) { + a + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } +} + +// TESTCASE NUMBER: 19 +fun case_19(b: Boolean) { + val a = if (b) { + object { + var y = null + val B19 = if (b) { + object { + val C19 = if (b) { + object { + val D19 = if (b) { + object { + val x: Number? = 10 + } + } else null + } + } else null + } + } else null + } + } else null + + if (a != null && a.B19 != a.y && a.B19.C19 != a.y && a.B19.C19.D19 != a.y && a.B19.C19.D19.x != a.y) { + a.B19.C19.D19.x + a.B19.C19.D19.x.equals(null) + a.B19.C19.D19.x.propT + a.B19.C19.D19.x.propAny + a.B19.C19.D19.x.propNullableT + a.B19.C19.D19.x.propNullableAny + a.B19.C19.D19.x.funT() + a.B19.C19.D19.x.funAny() + a.B19.C19.D19.x.funNullableT() + a.B19.C19.D19.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 20 +fun case_20(b: Boolean) { + val a = object { + val y = null + val B19 = object { + val C19 = object { + val D19 = if (b) { + object {} + } else null + } + } + } + + if (a.B19.C19.D19 !== null || a.y != a.B19.C19.D19) { + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19 + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.equals(null) + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.propT + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.propAny + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.propNullableT + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.propNullableAny + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.funT() + .B19..C19..D19."), DEBUG_INFO_SMARTCAST!>a.B19.C19.D19.funAny() + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.funNullableT() + .B19..C19..D19. & case_20..B19..C19..D19.?")!>a.B19.C19.D19.funNullableAny() + } +} + +// TESTCASE NUMBER: 21 +fun case_21() { + val y = null + if (EnumClassWithNullableProperty.A.prop_1 !== null && y != EnumClassWithNullableProperty.A.prop_1) { + EnumClassWithNullableProperty.A.prop_1 + EnumClassWithNullableProperty.A.prop_1.equals(null) + EnumClassWithNullableProperty.A.prop_1.propT + EnumClassWithNullableProperty.A.prop_1.propAny + EnumClassWithNullableProperty.A.prop_1.propNullableT + EnumClassWithNullableProperty.A.prop_1.propNullableAny + EnumClassWithNullableProperty.A.prop_1.funT() + EnumClassWithNullableProperty.A.prop_1.funAny() + EnumClassWithNullableProperty.A.prop_1.funNullableT() + EnumClassWithNullableProperty.A.prop_1.funNullableAny() + } +} + +// TESTCASE NUMBER: 22 +fun case_22(a: (() -> Unit)?) { + var y = null + if (a != null || y != a) { + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(null) + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propT + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propAny + kotlin.Unit)? & () -> kotlin.Unit")!>a.propNullableT + kotlin.Unit)? & () -> kotlin.Unit")!>a.propNullableAny + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funT() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funAny() + kotlin.Unit)? & () -> kotlin.Unit")!>a.funNullableT() + kotlin.Unit)? & () -> kotlin.Unit")!>a.funNullableAny() + } +} + +// TESTCASE NUMBER: 23 +fun case_23(a: ((Float) -> Int?)?, b: Float?, c: Nothing?) { + if (a != null && b !== null || a != c && b !== c) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (x != null || c !== x) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 24 +fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) = + if (a !== null && b !== null || implicitNullableNothingProperty != a && nullableNothingProperty !== b) { + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a( kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b) + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.equals(null) + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propT + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.propAny + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.propNullableT + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.propNullableAny + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funT() + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>a.funAny() + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.funNullableT() + kotlin.Unit) -> kotlin.Unit)? & (() -> kotlin.Unit) -> kotlin.Unit")!>a.funNullableAny() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.equals(null) + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.propT + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.propAny + kotlin.Unit)? & () -> kotlin.Unit")!>b.propNullableT + kotlin.Unit)? & () -> kotlin.Unit")!>b.propNullableAny + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.funT() + kotlin.Unit)? & () -> kotlin.Unit"), DEBUG_INFO_SMARTCAST!>b.funAny() + kotlin.Unit)? & () -> kotlin.Unit")!>b.funNullableT() + kotlin.Unit)? & () -> kotlin.Unit")!>b.funNullableAny() + } else null + +// TESTCASE NUMBER: 25 +fun case_25(b: Boolean) { + val x = { + if (b) object { + val a = 10 + val b = null + } else null + } + + val y = if (b) x else null + + if (y !== null || x()!!.b != y) { + if (x()!!.b != y) { + val z = .?")!> case_25..?)? & () -> case_25..?"), DEBUG_INFO_SMARTCAST!>y() + + if (z != null) { + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.a + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.equals(null) + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.propT + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.propAny + . & case_25..?")!>z.propNullableT + . & case_25..?")!>z.propNullableAny + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.funT() + . & case_25..?"), DEBUG_INFO_SMARTCAST!>z.funAny() + . & case_25..?")!>z.funNullableT() + . & case_25..?")!>z.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 26 +fun case_26(a: ((Float) -> Int?)?, b: Float?) { + var c: Nothing? = null + + if (a != null == true && b != null == true || c != a == true && b != c == true) { + val x = kotlin.Int?)? & (kotlin.Float) -> kotlin.Int?"), DEBUG_INFO_SMARTCAST!>a(b) + if (x != null == true) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 27 +fun case_27(y: Nothing?) { + if (Object.prop_1 == null == true == true == true == true == true == true == true == true == true == true == true == true == true == true || y == Object.prop_1 == true == true == true == false == false) + else { + Object.prop_1 + Object.prop_1.equals(null) + Object.prop_1.propT + Object.prop_1.propAny + Object.prop_1.propNullableT + Object.prop_1.propNullableAny + Object.prop_1.funT() + Object.prop_1.funAny() + Object.prop_1.funNullableT() + Object.prop_1.funNullableAny() + } +} + +//TESTCASE NUMBER: 28 +fun case_28(a: DeepObject.A.B.C.D.E.F.G.J?) = + if (a != null == true == false == false == false == true == false == true == false == false == true == true && a.x !== nullableNothingProperty) { + a.x + a.equals(null) + a.propT + a.propAny + a.propNullableT + a.propNullableAny + a.funT() + a.funAny() + a.funNullableT() + a.funNullableAny() + } else -1 + +// TESTCASE NUMBER: 29 +fun case_29(a: Int?, b: Nothing?, c: Int = if (a === b) 0 else a) { + a + b +} + +// TESTCASE NUMBER: 30 +fun case_30(a: Int?, b: Nothing?, c: Int = if (a === b || a == null) 0 else a) { + a + b +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.kt new file mode 100644 index 00000000000..30238b8d4af --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.kt @@ -0,0 +1,69 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 70 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes + */ + +/* + * TESTCASE NUMBER: 1 + * ISSUES: KT-11727 + */ +fun case_1(): Int? { + val x: Int? = null + return when (x != null) { + true -> { + x + x.inv() + } + else -> null + } +} + +/* + * TESTCASE NUMBER: 2 + * ISSUES: KT-11727 + */ +fun case_2(): Int? { + val x: Int? = null + return when (x != null) { + false -> { + x + } + else -> null + } +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-11727 + */ +fun case_3(): Int? { + val x: Int? = null + return when (x == null) { + false -> { + x + } + else -> null + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-11727 + */ +fun case_4(): Int? { + val x: Int? = null + return when (x == null) { + true -> { + x + } + else -> null + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.kt new file mode 100644 index 00000000000..f1ac4cfebdb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.kt @@ -0,0 +1,56 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 71 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-19446 + */ +fun case_1() { + run { + var unit: Unit? = Unit + while (unit != null) { + unit + consume(unit) + unit = null + } + } + + run { + var unit: Unit? = Unit + while (unit != null) { + unit + consume(unit) + unit = null + } + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-10420 + */ +fun case_2(): Int { + fun b(): Int { + var c: Int? = null + if (c == null || 0 < c) c = 0 + c + return c ?: 0 + } + + var c: Int = 0 + c = 0 + c + return c +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.kt new file mode 100644 index 00000000000..c3e51d15681 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.kt @@ -0,0 +1,26 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 72 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-19446 + */ +fun case_1() { + val list = mutableListOf() + val ints = list as MutableList + val strs = list as MutableList + strs.add("two") + & kotlin.collections.MutableList")!>list + val s: String = & kotlin.collections.MutableList"), DEBUG_INFO_SMARTCAST!>list[0] +} \ No newline at end of file diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.kt new file mode 100644 index 00000000000..2fc94dbf927 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.kt @@ -0,0 +1,44 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION -ASSIGNED_BUT_NEVER_ACCESSED_VARIABLE -UNUSED_PARAMETER -UNUSED_VARIABLE -UNUSED_VALUE -VARIABLE_WITH_REDUNDANT_INITIALIZER +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 73 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, objects, typealiases, functions, enumClasses, interfaces, sealedClasses + */ + +/* + * TESTCASE NUMBER: 1 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-14257 + */ +fun case_1(x: Any?) { + x is ClassLevel1 || return + x + x.test1() +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-14257 + */ +fun case_2(x: Any?) { + x !is ClassLevel1 && return + x + x.test1() +} + +/* + * TESTCASE NUMBER: 3 + * ISSUES: KT-14257 + */ +fun case_3(x: Any?) { + x as? ClassLevel1 ?: return + x + x.test1() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.kt new file mode 100644 index 00000000000..a0fe401f1d5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.kt @@ -0,0 +1,234 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 8 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: properties, classes, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Inv?) { + if (x != null) { + & Inv?")!>x + & Inv?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Inv?"), DEBUG_INFO_SMARTCAST!>x.propT + & Inv?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Inv?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 2 +fun case_2(a: Inv?>?>?>?>?>?) { + if (a != null) { + val b = ?>?>?>?>?> & Inv?>?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>a.get() + if (b != null) { + val c = ?>?>?>?> & Inv?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>b.get() + if (c != null) { + val d = ?>?>?> & Inv?>?>?>?"), DEBUG_INFO_SMARTCAST!>c.get() + if (d != null) { + val e = ?>?> & Inv?>?>?"), DEBUG_INFO_SMARTCAST!>d.get() + if (e != null) { + val f = ?> & Inv?>?"), DEBUG_INFO_SMARTCAST!>e.get() + if (f != null) { + val g = & Inv?"), DEBUG_INFO_SMARTCAST!>f.get() + if (g != null) { + g + g.equals(null) + g.propT + g.propAny + g.propNullableT + g.propNullableAny + g.funT() + g.funAny() + g.funNullableT() + g.funNullableAny() + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 3 +fun case_3(a: Inv?) { + if (a != null) { + val b = a + if (a == null) { + & Inv?")!>b + & Inv?"), DEBUG_INFO_SMARTCAST!>b.equals(null) + & Inv?"), DEBUG_INFO_SMARTCAST!>b.propT + & Inv?"), DEBUG_INFO_SMARTCAST!>b.propAny + & Inv?")!>b.propNullableT + & Inv?")!>b.propNullableAny + & Inv?"), DEBUG_INFO_SMARTCAST!>b.funT() + & Inv?"), DEBUG_INFO_SMARTCAST!>b.funAny() + & Inv?")!>b.funNullableT() + & Inv?")!>b.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 4 +fun case_4(a: Inv?, b: Inv = if (a != null) & Inv?"), DEBUG_INFO_SMARTCAST!>a else Inv()) { + ?")!>a + ")!>b + ")!>b.equals(null) + ")!>b.propT + ")!>b.propAny + ")!>b.propNullableT + ")!>b.propNullableAny + ")!>b.funT() + ")!>b.funAny() + ")!>b.funNullableT() + ")!>b.funNullableAny() +} + +// TESTCASE NUMBER: 5 +fun case_5() { + if (nullableOut != null) { + & Out?")!>nullableOut + & Out?"), DEBUG_INFO_SMARTCAST!>nullableOut.equals(null) + & Out?"), DEBUG_INFO_SMARTCAST!>nullableOut.propT + & Out?"), DEBUG_INFO_SMARTCAST!>nullableOut.propAny + & Out?")!>nullableOut.propNullableT + & Out?")!>nullableOut.propNullableAny + & Out?"), DEBUG_INFO_SMARTCAST!>nullableOut.funT() + & Out?"), DEBUG_INFO_SMARTCAST!>nullableOut.funAny() + & Out?")!>nullableOut.funNullableT() + & Out?")!>nullableOut.funNullableAny() + } +} + +// TESTCASE NUMBER: 6 +fun case_6() { + val x: Inv? = null + + if (x != null) { + & Inv?")!>x + & Inv?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Inv?"), DEBUG_INFO_SMARTCAST!>x.propT + & Inv?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Inv?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + var x: Inv? = null + + if (x != null) { + & Inv?")!>x + & Inv?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + & Inv?"), DEBUG_INFO_SMARTCAST!>x.propT + & Inv?"), DEBUG_INFO_SMARTCAST!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?"), DEBUG_INFO_SMARTCAST!>x.funT() + & Inv?"), DEBUG_INFO_SMARTCAST!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: ClassWithThreeTypeParameters?>?) { + if (x != null) { + ?> & ClassWithThreeTypeParameters?>?")!>x + ?> & ClassWithThreeTypeParameters?>?"), DEBUG_INFO_SMARTCAST!>x.equals(null) + ?> & ClassWithThreeTypeParameters?>?"), DEBUG_INFO_SMARTCAST!>x.propT + ?> & ClassWithThreeTypeParameters?>?"), DEBUG_INFO_SMARTCAST!>x.propAny + ?> & ClassWithThreeTypeParameters?>?")!>x.propNullableT + ?> & ClassWithThreeTypeParameters?>?")!>x.propNullableAny + ?> & ClassWithThreeTypeParameters?>?"), DEBUG_INFO_SMARTCAST!>x.funT() + ?> & ClassWithThreeTypeParameters?>?"), DEBUG_INFO_SMARTCAST!>x.funAny() + ?> & ClassWithThreeTypeParameters?>?")!>x.funNullableT() + ?> & ClassWithThreeTypeParameters?>?")!>x.funNullableAny() + if (x.x != null) { + x.x + x.x.equals(null) + x.x.propT + x.x.propAny + x.x.propNullableT + x.x.propNullableAny + x.x.funT() + x.x.funAny() + x.x.funNullableT() + x.x.funNullableAny() + } + if (x.y != null) { + x.y + x.y.equals(null) + x.y.propT + x.y.propAny + x.y.propNullableT + x.y.propNullableAny + x.y.funT() + x.y.funAny() + x.y.funNullableT() + x.y.funNullableAny() + } + if (x.z != null) { + & ClassWithThreeTypeParameters?")!>x.z + "), DEBUG_INFO_SMARTCAST!>x.z.equals(null) + "), DEBUG_INFO_SMARTCAST!>x.z.propT + "), DEBUG_INFO_SMARTCAST!>x.z.propAny + & ClassWithThreeTypeParameters?")!>x.z.propNullableT + & ClassWithThreeTypeParameters?")!>x.z.propNullableAny + "), DEBUG_INFO_SMARTCAST!>x.z.funT() + "), DEBUG_INFO_SMARTCAST!>x.z.funAny() + & ClassWithThreeTypeParameters?")!>x.z.funNullableT() + & ClassWithThreeTypeParameters?")!>x.z.funNullableAny() + if (x.z.x != null) { + x.z.x + x.z.x.equals(null) + x.z.x.propT + x.z.x.propAny + x.z.x.propNullableT + x.z.x.propNullableAny + x.z.x.funT() + x.z.x.funAny() + x.z.x.funNullableT() + x.z.x.funNullableAny() + } + if (x.z.y != null && x.z.z != null) { + x.z.y + x.z.y.equals(null) + x.z.y.propT + x.z.y.propAny + x.z.y.propNullableT + x.z.y.propNullableAny + x.z.y.funT() + x.z.y.funAny() + x.z.y.funNullableT() + x.z.y.funNullableAny() + x.z.z + x.z.z.equals(null) + x.z.z.propT + x.z.z.propAny + x.z.z.propNullableT + x.z.z.propNullableAny + x.z.z.funT() + x.z.z.funAny() + x.z.z.funNullableT() + x.z.z.funNullableAny() + } + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.kt new file mode 100644 index 00000000000..ba8e133e7e1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.kt @@ -0,0 +1,717 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 9 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, properties, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Out<out Int?>?) { + if (x != null) { + & Out?")!>x + & Out?")!>x.equals(null) + & Out?")!>x.propT + & Out?")!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?")!>x.funT() + & Out?")!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28598 + */ +fun case_2(a: Out<out Out<out Out<out Out<out Out<out Out<out Int?>?>?>?>?>?>?) { + if (a != null) { + val b = ?>?>?>?>?> & Out?>?>?>?>?>?")!>a.get() + if (b != null) { + val c = ?>?>?>?> & Out?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>b.get() + if (c != null) { + val d = ?>?>?> & Out?>?>?>?"), DEBUG_INFO_SMARTCAST!>c.get() + if (d != null) { + val e = ?>?> & Out?>?>?"), DEBUG_INFO_SMARTCAST!>d.get() + if (e != null) { + val f = ?> & Out?>?"), DEBUG_INFO_SMARTCAST!>e.get() + if (f != null) { + val g = & Out?"), DEBUG_INFO_SMARTCAST!>f.get() + if (g != null) { + g + g.equals(null) + g.propT + g.propAny + g.propNullableT + g.propNullableAny + g.funT() + g.funAny() + g.funNullableT() + g.funNullableAny() + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 3 +fun case_3(a: Inv?) { + if (a != null) { + val b = a + if (a == null) + & Inv?")!>b + & Inv?")!>b.equals(null) + & Inv?")!>b.propT + & Inv?")!>b.propAny + & Inv?")!>b.propNullableT + & Inv?")!>b.propNullableAny + & Inv?")!>b.funT() + & Inv?")!>b.funAny() + & Inv?")!>b.funNullableT() + & Inv?")!>b.funNullableAny() + } +} + +// TESTCASE NUMBER: 4 +fun case_4(a: Out<out Int>?, b: Out<out Int> = if (a != null) & Out?"), DEBUG_INFO_SMARTCAST!>a else Out()) { + ?")!>a + ")!>b + ")!>b.equals(null) + ")!>b.propT + ")!>b.propAny + ")!>b.propNullableT + ")!>b.propNullableAny + ")!>b.funT() + ")!>b.funAny() + ")!>b.funNullableT() + ")!>b.funNullableAny() +} + +// TESTCASE NUMBER: 5 +val x: Out<out Int>? = null + +fun case_5() { + if (x != null) { + & Out?")!>x + & Out?")!>x.equals(null) + & Out?")!>x.propT + & Out?")!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?")!>x.funT() + & Out?")!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 6 +fun case_6() { + val x: Inv? = null + + if (x != null) { + & Inv?")!>x + & Inv?")!>x.equals(null) + & Inv?")!>x.propT + & Inv?")!>x.propAny + & Inv?")!>x.propNullableT + & Inv?")!>x.propNullableAny + & Inv?")!>x.funT() + & Inv?")!>x.funAny() + & Inv?")!>x.funNullableT() + & Inv?")!>x.funNullableAny() + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + var x: Out<out Int>? = null + + if (x != null) { + & Out?")!>x + & Out?")!>x.equals(null) + & Out?")!>x.propT + & Out?")!>x.propAny + & Out?")!>x.propNullableT + & Out?")!>x.propNullableAny + & Out?")!>x.funT() + & Out?")!>x.funAny() + & Out?")!>x.funNullableT() + & Out?")!>x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 8 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-25432 + */ +fun case_8(x: ClassWithThreeTypeParameters?>?) { + if (x != null) { + ?> & ClassWithThreeTypeParameters?>?")!>x + ?> & ClassWithThreeTypeParameters?>?")!>x.equals(null) + ?> & ClassWithThreeTypeParameters?>?")!>x.propT + ?> & ClassWithThreeTypeParameters?>?")!>x.propAny + ?> & ClassWithThreeTypeParameters?>?")!>x.propNullableT + ?> & ClassWithThreeTypeParameters?>?")!>x.propNullableAny + ?> & ClassWithThreeTypeParameters?>?")!>x.funT() + ?> & ClassWithThreeTypeParameters?>?")!>x.funAny() + ?> & ClassWithThreeTypeParameters?>?")!>x.funNullableT() + ?> & ClassWithThreeTypeParameters?>?")!>x.funNullableAny() + if (x.x != null) { + x.x + x.x.equals(null) + x.x.propT + x.x.propAny + x.x.propNullableT + x.x.propNullableAny + x.x.funT() + x.x.funAny() + x.x.funNullableT() + x.x.funNullableAny() + } + if (x.y != null) { + x.y + x.y.equals(null) + x.y.propT + x.y.propAny + x.y.propNullableT + x.y.propNullableAny + x.y.funT() + x.y.funAny() + x.y.funNullableT() + x.y.funNullableAny() + } + if (x.z != null) { + ?")!>x.z + ?")!>x.z.equals(null) + ?")!>x.z.propT + ?")!>x.z.propAny + ?")!>x.z.propNullableT + ?")!>x.z.propNullableAny + ?")!>x.z.funT() + ?")!>x.z.funAny() + ?")!>x.z.funNullableT() + ?")!>x.z.funNullableAny() + if (x.z.x != null) { + x.z.x + x.z.x.equals(null) + x.z.x.propT + x.z.x.propAny + x.z.x.propNullableT + x.z.x.propNullableAny + x.z.x.funT() + x.z.x.funAny() + x.z.x.funNullableT() + x.z.x.funNullableAny() + } + if (x.z.y != null && x.z.z != null) { + x.z.y + x.z.z + x.z.y.equals(null) + x.z.y.propT + x.z.y.propAny + x.z.y.propNullableT + x.z.y.propNullableAny + x.z.y.funT() + x.z.y.funAny() + x.z.y.funNullableT() + x.z.y.funNullableAny() + x.z.z.equals(null) + x.z.z.propT + x.z.z.propAny + x.z.z.propNullableT + x.z.z.propNullableAny + x.z.z.funT() + x.z.z.funAny() + x.z.z.funNullableT() + x.z.z.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 9 +fun case_9(a: (Inv) -> Inv?, b: Inv?) { + if (b != null) { + val c = a(b) + if (c != null) { + & Inv?")!>c + & Inv?")!>c.equals(null) + & Inv?")!>c.propT + & Inv?")!>c.propAny + & Inv?")!>c.propNullableT + & Inv?")!>c.propNullableAny + & Inv?")!>c.funT() + & Inv?")!>c.funAny() + & Inv?")!>c.funNullableT() + & Inv?")!>c.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 10 +fun case_9(a: Inv<*>?) { + if (a != null) { + & Inv<*>?")!>a + & Inv<*>?")!>a.equals(null) + & Inv<*>?")!>a.propT + & Inv<*>?")!>a.propAny + & Inv<*>?")!>a.propNullableT + & Inv<*>?")!>a.propNullableAny + & Inv<*>?")!>a.funT() + & Inv<*>?")!>a.funAny() + & Inv<*>?")!>a.funNullableT() + & Inv<*>?")!>a.funNullableAny() + } +} + +// TESTCASE NUMBER: 11 +fun case_10() { + val a10: Out<*>? = null + + if (a10 != null) { + & Out<*>?")!>a10 + & Out<*>?")!>a10.equals(null) + & Out<*>?")!>a10.propT + & Out<*>?")!>a10.propAny + & Out<*>?")!>a10.propNullableT + & Out<*>?")!>a10.propNullableAny + & Out<*>?")!>a10.funT() + & Out<*>?")!>a10.funAny() + & Out<*>?")!>a10.funNullableT() + & Out<*>?")!>a10.funNullableAny() + } +} + +// TESTCASE NUMBER: 12 +fun case_11() { + val a: In<*>? = null + + if (a != null) { + & In<*>?")!>a + & In<*>?")!>a.equals(null) + & In<*>?")!>a.propT + & In<*>?")!>a.propAny + & In<*>?")!>a.propNullableT + & In<*>?")!>a.propNullableAny + & In<*>?")!>a.funT() + & In<*>?")!>a.funAny() + & In<*>?")!>a.funNullableT() + & In<*>?")!>a.funNullableAny() + } +} + +// TESTCASE NUMBER: 13 +fun case_13(a: ClassWithSixTypeParameters<*, *, *, *, *, *>?) { + if (a != null) { + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.equals(null) + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.propT + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.propAny + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.propNullableT + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.propNullableAny + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.funT() + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.funAny() + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.funNullableT() + & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>a.funNullableAny() + } +} + +// TESTCASE NUMBER: 14 +fun case_14(a: ClassWithSixTypeParameters<*, Int, *, Out<*>, *, Map>>?) { + if (a != null) { + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.equals(null) + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.propT + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.propAny + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.propNullableT + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.propNullableAny + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.funT() + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.funAny() + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.funNullableT() + , *, kotlin.collections.Map>> & ClassWithSixTypeParameters<*, kotlin.Int, *, Out<*>, *, kotlin.collections.Map>>?")!>a.funNullableAny() + } +} + +// TESTCASE NUMBER: 15 +fun case_15(a: Any?) { + if (a is ClassWithSixTypeParameters<*, *, *, *, *, *>?) { + if (a != null) { + a + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.equals(null) + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.propT + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.propAny + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.propNullableT + & kotlin.Any & kotlin.Any?")!>a.propNullableAny + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.funT() + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.funAny() + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.funNullableT() + & kotlin.Any & kotlin.Any?")!>a.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 16 +fun case_16(a: Any?) { + if (a === null) { + } else { + if (a !is ClassWithSixTypeParameters<*, *, *, *, *, *>?) { + } else { + & kotlin.Any & kotlin.Any?")!>a + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.equals(null) + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.propT + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.propAny + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.propNullableT + & kotlin.Any & kotlin.Any?")!>a.propNullableAny + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.funT() + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.funAny() + & kotlin.Any?"), DEBUG_INFO_SMARTCAST!>a.funNullableT() + & kotlin.Any & kotlin.Any?")!>a.funNullableAny() + } + } +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28598 + */ +fun case_17(a: Inv?>?>?>?>?>?) { + if (a != null) { + val b = ?>?>?>?>?> & Inv?>?>?>?>?>?")!>a.get() + if (b != null) { + val c = ?>?>?>?> & Out?>?>?>?>?"), DEBUG_INFO_SMARTCAST!>b.get() + if (c != null) { + val d = ?>?>?> & Out?>?>?>?"), DEBUG_INFO_SMARTCAST!>c.get() + if (d != null) { + val e = ?>?> & Out?>?>?"), DEBUG_INFO_SMARTCAST!>d.get() + if (e != null) { + val f = ?> & Out?>?"), DEBUG_INFO_SMARTCAST!>e.get() + if (f != null) { + val g = & Out?"), DEBUG_INFO_SMARTCAST!>f.get() + if (g != null) { + g + g.equals(null) + g.propT + g.propAny + g.propNullableT + g.propNullableAny + g.funT() + g.funAny() + g.funNullableT() + g.funNullableAny() + } + } + } + } + } + } + } +} + +/* + * TESTCASE NUMBER: 18 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_18(a: Inv) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 19 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_19(a: Inv) { + if (a.x != null) { + a.x + a.x.hashCode() + } +} + +/* + * TESTCASE NUMBER: 20 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_20(a: Inv) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 21 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_21(a: Out<out Int?>) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 22 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_22(a: Out<out Nothing?>) { + if (a.x != null) { + a.x + a.x.hashCode() + } +} + +/* + * TESTCASE NUMBER: 23 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_23(a: Out<out Any?>) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 24 +fun case_24(a: Out) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 25 +fun case_25(a: Out) { + if (a.x != null) { + a.x + a.x.hashCode() + } +} + +// TESTCASE NUMBER: 26 +fun case_26(a: Out) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 27 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_27(a: Inv) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 28 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_28(a: Inv) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +/* + * TESTCASE NUMBER: 29 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_29(a: Inv) { + if (a.x != null) { + a.x + a.x.equals(null) + a.x.propT + a.x.propAny + a.x.propNullableT + a.x.propNullableAny + a.x.funT() + a.x.funAny() + a.x.funNullableT() + a.x.funNullableAny() + } +} + +// TESTCASE NUMBER: 30 +fun case_30() { + val a = In() + val b = a.getWithUpperBoundT() + + if (b != null) { + b + b.equals(null) + b.propT + b.propAny + b.propNullableT + b.propNullableAny + b.funT() + b.funAny() + b.funNullableT() + b.funNullableAny() + } +} + +// TESTCASE NUMBER: 31 +fun case_31(y: Inv) { + val x = y.get() + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 32 +fun case_32(y: Inv) { + val x = y.getNullable() + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 33 +fun case_33(y: Inv) { + val x = y.getNullable() + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} + +// TESTCASE NUMBER: 34 +fun case_34(y: Inv) { + val x = y.getNullable() + + if (x != null) { + x + x.equals(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + } +} diff --git a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java index be8f962f1cc..22f9c412431 100644 --- a/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java +++ b/compiler/tests-spec/tests/org/jetbrains/kotlin/checkers/DiagnosticsTestSpecGenerated.java @@ -1,5 +1,5 @@ /* - * Copyright 2010-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license + * Copyright 2010-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license * that can be found in the license/LICENSE.txt file. */ @@ -803,161 +803,6 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Type_inference extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInType_inference() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Smart_casts extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInSmart_casts() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Smart_casts_sources extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInSmart_casts_sources() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class P_4 extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - public void testAllFilesPresentInP_4() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos") - @TestDataPath("$PROJECT_ROOT") - @RunWith(JUnit3RunnerWithInners.class) - public static class Pos extends AbstractDiagnosticsTestSpec { - private void runTest(String testDataFilePath) throws Exception { - KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); - } - - @TestMetadata("1.1.kt") - public void test1_1() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.1.kt"); - } - - @TestMetadata("1.10.kt") - public void test1_10() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.10.kt"); - } - - @TestMetadata("1.11.kt") - public void test1_11() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.11.kt"); - } - - @TestMetadata("1.12.kt") - public void test1_12() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.12.kt"); - } - - @TestMetadata("1.13.kt") - public void test1_13() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.13.kt"); - } - - @TestMetadata("1.14.kt") - public void test1_14() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.14.kt"); - } - - @TestMetadata("1.15.kt") - public void test1_15() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.15.kt"); - } - - @TestMetadata("1.16.kt") - public void test1_16() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.16.kt"); - } - - @TestMetadata("1.17.kt") - public void test1_17() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.17.kt"); - } - - @TestMetadata("1.18.kt") - public void test1_18() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.18.kt"); - } - - @TestMetadata("1.2.kt") - public void test1_2() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.2.kt"); - } - - @TestMetadata("1.3.kt") - public void test1_3() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.3.kt"); - } - - @TestMetadata("1.4.kt") - public void test1_4() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.4.kt"); - } - - @TestMetadata("1.5.kt") - public void test1_5() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.5.kt"); - } - - @TestMetadata("1.6.kt") - public void test1_6() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.6.kt"); - } - - @TestMetadata("1.7.kt") - public void test1_7() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.7.kt"); - } - - @TestMetadata("1.8.kt") - public void test1_8() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.8.kt"); - } - - @TestMetadata("1.9.kt") - public void test1_9() throws Exception { - runTest("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos/1.9.kt"); - } - - public void testAllFilesPresentInPos() throws Exception { - KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/linked/type-inference/smart-casts/smart-casts-sources/p-4/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); - } - } - } - } - } - } - @TestMetadata("compiler/tests-spec/testData/diagnostics/linked/when-expression") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class) @@ -2525,6 +2370,635 @@ public class DiagnosticsTestSpecGenerated extends AbstractDiagnosticsTestSpec { } } + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/dfa") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Dfa extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + public void testAllFilesPresentInDfa() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/notLinked/dfa"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Neg extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.kt") + public void test1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.kt"); + } + + @TestMetadata("10.kt") + public void test10() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.kt"); + } + + @TestMetadata("11.kt") + public void test11() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.kt"); + } + + @TestMetadata("12.kt") + public void test12() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.kt"); + } + + @TestMetadata("13.kt") + public void test13() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.kt"); + } + + @TestMetadata("14.kt") + public void test14() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.kt"); + } + + @TestMetadata("15.kt") + public void test15() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.kt"); + } + + @TestMetadata("16.kt") + public void test16() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.kt"); + } + + @TestMetadata("17.kt") + public void test17() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.kt"); + } + + @TestMetadata("18.kt") + public void test18() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/18.kt"); + } + + @TestMetadata("19.kt") + public void test19() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.kt"); + } + + @TestMetadata("2.kt") + public void test2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.kt"); + } + + @TestMetadata("20.kt") + public void test20() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.kt"); + } + + @TestMetadata("21.kt") + public void test21() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.kt"); + } + + @TestMetadata("22.kt") + public void test22() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.kt"); + } + + @TestMetadata("23.kt") + public void test23() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.kt"); + } + + @TestMetadata("24.kt") + public void test24() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.kt"); + } + + @TestMetadata("25.kt") + public void test25() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.kt"); + } + + @TestMetadata("26.kt") + public void test26() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.kt"); + } + + @TestMetadata("27.kt") + public void test27() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.kt"); + } + + @TestMetadata("28.kt") + public void test28() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.kt"); + } + + @TestMetadata("29.kt") + public void test29() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.kt"); + } + + @TestMetadata("3.kt") + public void test3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.kt"); + } + + @TestMetadata("30.kt") + public void test30() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.kt"); + } + + @TestMetadata("31.kt") + public void test31() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.kt"); + } + + @TestMetadata("32.kt") + public void test32() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.kt"); + } + + @TestMetadata("33.kt") + public void test33() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.kt"); + } + + @TestMetadata("34.kt") + public void test34() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.kt"); + } + + @TestMetadata("35.kt") + public void test35() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.kt"); + } + + @TestMetadata("36.kt") + public void test36() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.kt"); + } + + @TestMetadata("37.kt") + public void test37() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.kt"); + } + + @TestMetadata("38.kt") + public void test38() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.kt"); + } + + @TestMetadata("39.kt") + public void test39() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.kt"); + } + + @TestMetadata("4.kt") + public void test4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.kt"); + } + + @TestMetadata("40.kt") + public void test40() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.kt"); + } + + @TestMetadata("41.kt") + public void test41() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.kt"); + } + + @TestMetadata("42.kt") + public void test42() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.kt"); + } + + @TestMetadata("43.kt") + public void test43() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.kt"); + } + + @TestMetadata("44.kt") + public void test44() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.kt"); + } + + @TestMetadata("45.kt") + public void test45() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.kt"); + } + + @TestMetadata("5.kt") + public void test5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.kt"); + } + + @TestMetadata("6.kt") + public void test6() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.kt"); + } + + @TestMetadata("7.kt") + public void test7() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.kt"); + } + + @TestMetadata("8.kt") + public void test8() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.kt"); + } + + @TestMetadata("9.kt") + public void test9() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.kt"); + } + + public void testAllFilesPresentInNeg() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + } + + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos") + @TestDataPath("$PROJECT_ROOT") + @RunWith(JUnit3RunnerWithInners.class) + public static class Pos extends AbstractDiagnosticsTestSpec { + private void runTest(String testDataFilePath) throws Exception { + KotlinTestUtils.runTest(this::doTest, TargetBackend.ANY, testDataFilePath); + } + + @TestMetadata("1.kt") + public void test1() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.kt"); + } + + @TestMetadata("10.kt") + public void test10() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.kt"); + } + + @TestMetadata("11.kt") + public void test11() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.kt"); + } + + @TestMetadata("12.kt") + public void test12() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.kt"); + } + + @TestMetadata("13.kt") + public void test13() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.kt"); + } + + @TestMetadata("14.kt") + public void test14() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.kt"); + } + + @TestMetadata("15.kt") + public void test15() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.kt"); + } + + @TestMetadata("16.kt") + public void test16() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.kt"); + } + + @TestMetadata("17.kt") + public void test17() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.kt"); + } + + @TestMetadata("18.kt") + public void test18() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.kt"); + } + + @TestMetadata("19.kt") + public void test19() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.kt"); + } + + @TestMetadata("2.kt") + public void test2() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.kt"); + } + + @TestMetadata("20.kt") + public void test20() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.kt"); + } + + @TestMetadata("21.kt") + public void test21() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.kt"); + } + + @TestMetadata("22.kt") + public void test22() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.kt"); + } + + @TestMetadata("23.kt") + public void test23() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.kt"); + } + + @TestMetadata("24.kt") + public void test24() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.kt"); + } + + @TestMetadata("25.kt") + public void test25() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.kt"); + } + + @TestMetadata("26.kt") + public void test26() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.kt"); + } + + @TestMetadata("27.kt") + public void test27() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.kt"); + } + + @TestMetadata("28.kt") + public void test28() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.kt"); + } + + @TestMetadata("29.kt") + public void test29() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.kt"); + } + + @TestMetadata("3.kt") + public void test3() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.kt"); + } + + @TestMetadata("30.kt") + public void test30() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.kt"); + } + + @TestMetadata("31.kt") + public void test31() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.kt"); + } + + @TestMetadata("32.kt") + public void test32() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.kt"); + } + + @TestMetadata("33.kt") + public void test33() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.kt"); + } + + @TestMetadata("34.kt") + public void test34() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.kt"); + } + + @TestMetadata("35.kt") + public void test35() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.kt"); + } + + @TestMetadata("36.kt") + public void test36() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.kt"); + } + + @TestMetadata("37.kt") + public void test37() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.kt"); + } + + @TestMetadata("38.kt") + public void test38() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.kt"); + } + + @TestMetadata("39.kt") + public void test39() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.kt"); + } + + @TestMetadata("4.kt") + public void test4() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.kt"); + } + + @TestMetadata("40.kt") + public void test40() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.kt"); + } + + @TestMetadata("41.kt") + public void test41() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.kt"); + } + + @TestMetadata("42.kt") + public void test42() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.kt"); + } + + @TestMetadata("43.kt") + public void test43() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.kt"); + } + + @TestMetadata("44.kt") + public void test44() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.kt"); + } + + @TestMetadata("45.kt") + public void test45() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.kt"); + } + + @TestMetadata("46.kt") + public void test46() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.kt"); + } + + @TestMetadata("47.kt") + public void test47() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.kt"); + } + + @TestMetadata("48.kt") + public void test48() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.kt"); + } + + @TestMetadata("49.kt") + public void test49() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.kt"); + } + + @TestMetadata("5.kt") + public void test5() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.kt"); + } + + @TestMetadata("50.kt") + public void test50() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.kt"); + } + + @TestMetadata("51.kt") + public void test51() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.kt"); + } + + @TestMetadata("52.kt") + public void test52() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.kt"); + } + + @TestMetadata("53.kt") + public void test53() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.kt"); + } + + @TestMetadata("54.kt") + public void test54() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.kt"); + } + + @TestMetadata("55.kt") + public void test55() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.kt"); + } + + @TestMetadata("56.kt") + public void test56() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.kt"); + } + + @TestMetadata("57.kt") + public void test57() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.kt"); + } + + @TestMetadata("58.kt") + public void test58() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.kt"); + } + + @TestMetadata("59.kt") + public void test59() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.kt"); + } + + @TestMetadata("6.kt") + public void test6() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.kt"); + } + + @TestMetadata("60.kt") + public void test60() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.kt"); + } + + @TestMetadata("61.kt") + public void test61() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.kt"); + } + + @TestMetadata("62.kt") + public void test62() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/62.kt"); + } + + @TestMetadata("63.kt") + public void test63() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.kt"); + } + + @TestMetadata("64.kt") + public void test64() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.kt"); + } + + @TestMetadata("65.kt") + public void test65() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.kt"); + } + + @TestMetadata("66.kt") + public void test66() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.kt"); + } + + @TestMetadata("67.kt") + public void test67() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.kt"); + } + + @TestMetadata("68.kt") + public void test68() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.kt"); + } + + @TestMetadata("69.kt") + public void test69() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.kt"); + } + + @TestMetadata("7.kt") + public void test7() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.kt"); + } + + @TestMetadata("70.kt") + public void test70() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.kt"); + } + + @TestMetadata("71.kt") + public void test71() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.kt"); + } + + @TestMetadata("72.kt") + public void test72() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.kt"); + } + + @TestMetadata("73.kt") + public void test73() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.kt"); + } + + @TestMetadata("8.kt") + public void test8() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.kt"); + } + + @TestMetadata("9.kt") + public void test9() throws Exception { + runTest("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.kt"); + } + + public void testAllFilesPresentInPos() throws Exception { + KotlinTestUtils.assertAllTestsPresentByMetadata(this.getClass(), new File("compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos"), Pattern.compile("^(.+)\\.kt$"), TargetBackend.ANY, true); + } + } + } + @TestMetadata("compiler/tests-spec/testData/diagnostics/notLinked/local-variables") @TestDataPath("$PROJECT_ROOT") @RunWith(JUnit3RunnerWithInners.class)