// !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() } } } }