From 0d34299b7a36a7d0bff64b8d2a27dcef5ab96e72 Mon Sep 17 00:00:00 2001 From: Denis Zharkov Date: Wed, 15 Apr 2020 13:06:26 +0300 Subject: [PATCH] FIR: Adjust testData for spec tests: dfa --- .../diagnostics/notLinked/dfa/neg/1.fir.kt | 483 ++ .../diagnostics/notLinked/dfa/neg/10.fir.kt | 26 + .../diagnostics/notLinked/dfa/neg/11.fir.kt | 84 + .../diagnostics/notLinked/dfa/neg/12.fir.kt | 57 + .../diagnostics/notLinked/dfa/neg/13.fir.kt | 40 + .../diagnostics/notLinked/dfa/neg/14.fir.kt | 60 + .../diagnostics/notLinked/dfa/neg/15.fir.kt | 144 + .../diagnostics/notLinked/dfa/neg/16.fir.kt | 115 + .../diagnostics/notLinked/dfa/neg/17.fir.kt | 38 + .../diagnostics/notLinked/dfa/neg/18.fir.kt | 78 + .../diagnostics/notLinked/dfa/neg/19.fir.kt | 386 ++ .../diagnostics/notLinked/dfa/neg/2.fir.kt | 99 + .../diagnostics/notLinked/dfa/neg/20.fir.kt | 401 ++ .../diagnostics/notLinked/dfa/neg/21.fir.kt | 55 + .../diagnostics/notLinked/dfa/neg/22.fir.kt | 233 + .../diagnostics/notLinked/dfa/neg/23.fir.kt | 77 + .../diagnostics/notLinked/dfa/neg/24.fir.kt | 118 + .../diagnostics/notLinked/dfa/neg/25.fir.kt | 62 + .../diagnostics/notLinked/dfa/neg/26.fir.kt | 125 + .../diagnostics/notLinked/dfa/neg/27.fir.kt | 121 + .../diagnostics/notLinked/dfa/neg/28.fir.kt | 20 + .../diagnostics/notLinked/dfa/neg/29.fir.kt | 125 + .../diagnostics/notLinked/dfa/neg/3.fir.kt | 102 + .../diagnostics/notLinked/dfa/neg/30.fir.kt | 47 + .../diagnostics/notLinked/dfa/neg/31.fir.kt | 21 + .../diagnostics/notLinked/dfa/neg/32.fir.kt | 79 + .../diagnostics/notLinked/dfa/neg/33.fir.kt | 71 + .../diagnostics/notLinked/dfa/neg/34.fir.kt | 222 + .../diagnostics/notLinked/dfa/neg/35.fir.kt | 129 + .../diagnostics/notLinked/dfa/neg/36.fir.kt | 92 + .../diagnostics/notLinked/dfa/neg/37.fir.kt | 118 + .../diagnostics/notLinked/dfa/neg/38.fir.kt | 187 + .../diagnostics/notLinked/dfa/neg/39.fir.kt | 176 + .../diagnostics/notLinked/dfa/neg/4.fir.kt | 194 + .../diagnostics/notLinked/dfa/neg/40.fir.kt | 32 + .../diagnostics/notLinked/dfa/neg/41.fir.kt | 98 + .../diagnostics/notLinked/dfa/neg/42.fir.kt | 168 + .../diagnostics/notLinked/dfa/neg/43.fir.kt | 90 + .../diagnostics/notLinked/dfa/neg/44.fir.kt | 56 + .../diagnostics/notLinked/dfa/neg/45.fir.kt | 30 + .../diagnostics/notLinked/dfa/neg/5.fir.kt | 22 + .../diagnostics/notLinked/dfa/neg/6.fir.kt | 150 + .../diagnostics/notLinked/dfa/neg/7.fir.kt | 60 + .../diagnostics/notLinked/dfa/neg/8.fir.kt | 50 + .../diagnostics/notLinked/dfa/neg/9.fir.kt | 31 + .../diagnostics/notLinked/dfa/pos/1.fir.kt | 4215 ++++++++++++++++ .../diagnostics/notLinked/dfa/pos/10.fir.kt | 629 +++ .../diagnostics/notLinked/dfa/pos/11.fir.kt | 278 ++ .../diagnostics/notLinked/dfa/pos/12.fir.kt | 3914 +++++++++++++++ .../diagnostics/notLinked/dfa/pos/13.fir.kt | 4367 +++++++++++++++++ .../diagnostics/notLinked/dfa/pos/14.fir.kt | 61 + .../diagnostics/notLinked/dfa/pos/15.fir.kt | 199 + .../diagnostics/notLinked/dfa/pos/16.fir.kt | 734 +++ .../diagnostics/notLinked/dfa/pos/17.fir.kt | 354 ++ .../diagnostics/notLinked/dfa/pos/18.fir.kt | 420 ++ .../diagnostics/notLinked/dfa/pos/19.fir.kt | 102 + .../diagnostics/notLinked/dfa/pos/2.fir.kt | 506 ++ .../diagnostics/notLinked/dfa/pos/20.fir.kt | 114 + .../diagnostics/notLinked/dfa/pos/21.fir.kt | 122 + .../diagnostics/notLinked/dfa/pos/22.fir.kt | 160 + .../diagnostics/notLinked/dfa/pos/23.fir.kt | 51 + .../diagnostics/notLinked/dfa/pos/24.fir.kt | 26 + .../diagnostics/notLinked/dfa/pos/25.fir.kt | 78 + .../diagnostics/notLinked/dfa/pos/26.fir.kt | 78 + .../diagnostics/notLinked/dfa/pos/27.fir.kt | 78 + .../diagnostics/notLinked/dfa/pos/28.fir.kt | 358 ++ .../diagnostics/notLinked/dfa/pos/29.fir.kt | 99 + .../diagnostics/notLinked/dfa/pos/3.fir.kt | 311 ++ .../diagnostics/notLinked/dfa/pos/30.fir.kt | 187 + .../diagnostics/notLinked/dfa/pos/31.fir.kt | 141 + .../diagnostics/notLinked/dfa/pos/32.fir.kt | 31 + .../diagnostics/notLinked/dfa/pos/33.fir.kt | 99 + .../diagnostics/notLinked/dfa/pos/34.fir.kt | 148 + .../diagnostics/notLinked/dfa/pos/35.fir.kt | 95 + .../diagnostics/notLinked/dfa/pos/36.fir.kt | 204 + .../diagnostics/notLinked/dfa/pos/37.fir.kt | 220 + .../diagnostics/notLinked/dfa/pos/38.fir.kt | 91 + .../diagnostics/notLinked/dfa/pos/39.fir.kt | 73 + .../diagnostics/notLinked/dfa/pos/4.fir.kt | 297 ++ .../diagnostics/notLinked/dfa/pos/40.fir.kt | 176 + .../diagnostics/notLinked/dfa/pos/41.fir.kt | 66 + .../diagnostics/notLinked/dfa/pos/42.fir.kt | 55 + .../diagnostics/notLinked/dfa/pos/43.fir.kt | 126 + .../diagnostics/notLinked/dfa/pos/44.fir.kt | 62 + .../diagnostics/notLinked/dfa/pos/45.fir.kt | 114 + .../diagnostics/notLinked/dfa/pos/46.fir.kt | 123 + .../diagnostics/notLinked/dfa/pos/47.fir.kt | 81 + .../diagnostics/notLinked/dfa/pos/48.fir.kt | 68 + .../diagnostics/notLinked/dfa/pos/49.fir.kt | 60 + .../diagnostics/notLinked/dfa/pos/5.fir.kt | 391 ++ .../diagnostics/notLinked/dfa/pos/50.fir.kt | 114 + .../diagnostics/notLinked/dfa/pos/51.fir.kt | 356 ++ .../diagnostics/notLinked/dfa/pos/52.fir.kt | 123 + .../diagnostics/notLinked/dfa/pos/53.fir.kt | 104 + .../diagnostics/notLinked/dfa/pos/54.fir.kt | 307 ++ .../diagnostics/notLinked/dfa/pos/55.fir.kt | 56 + .../diagnostics/notLinked/dfa/pos/56.fir.kt | 55 + .../diagnostics/notLinked/dfa/pos/57.fir.kt | 135 + .../diagnostics/notLinked/dfa/pos/58.fir.kt | 89 + .../diagnostics/notLinked/dfa/pos/59.fir.kt | 215 + .../diagnostics/notLinked/dfa/pos/6.fir.kt | 1424 ++++++ .../diagnostics/notLinked/dfa/pos/60.fir.kt | 25 + .../diagnostics/notLinked/dfa/pos/61.fir.kt | 173 + .../diagnostics/notLinked/dfa/pos/62.fir.kt | 463 ++ .../diagnostics/notLinked/dfa/pos/63.fir.kt | 81 + .../diagnostics/notLinked/dfa/pos/64.fir.kt | 105 + .../diagnostics/notLinked/dfa/pos/65.fir.kt | 120 + .../diagnostics/notLinked/dfa/pos/66.fir.kt | 97 + .../diagnostics/notLinked/dfa/pos/67.fir.kt | 49 + .../diagnostics/notLinked/dfa/pos/68.fir.kt | 76 + .../diagnostics/notLinked/dfa/pos/69.fir.kt | 53 + .../diagnostics/notLinked/dfa/pos/7.fir.kt | 569 +++ .../diagnostics/notLinked/dfa/pos/70.fir.kt | 69 + .../diagnostics/notLinked/dfa/pos/71.fir.kt | 56 + .../diagnostics/notLinked/dfa/pos/72.fir.kt | 26 + .../diagnostics/notLinked/dfa/pos/73.fir.kt | 44 + .../diagnostics/notLinked/dfa/pos/8.fir.kt | 234 + .../diagnostics/notLinked/dfa/pos/9.fir.kt | 717 +++ 118 files changed, 31269 insertions(+) create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/18.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/62.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.fir.kt create mode 100644 compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.kt new file mode 100644 index 00000000000..30a51775b6d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/1.fir.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) { + a.B19.C19.D19 + a.B19.C19.D19.equals(null) + a.B19.C19.D19.propT + a.B19.C19.D19.propAny + a.B19.C19.D19.propNullableT + a.B19.C19.D19.propNullableAny + a.B19.C19.D19.funT() + a.B19.C19.D19.funAny() + a.B19.C19.D19.funNullableT() + 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(?")!>b) + a(b) + ?")!>b.equals(null) + ?")!>b.propT + ?")!>b.propAny + ?")!>b.propNullableT + ?")!>b.propNullableAny + ?")!>b.funT() + ?")!>b.funAny() + ?")!>b.funNullableT() + ?")!>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() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.kt new file mode 100644 index 00000000000..b2852bd9c66 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/10.fir.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() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt new file mode 100644 index 00000000000..dcf6fb6e227 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/11.fir.kt @@ -0,0 +1,84 @@ +// !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 + * ISSUES: KT-35668 + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt new file mode 100644 index 00000000000..85a5be6e433 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/12.fir.kt @@ -0,0 +1,57 @@ +// !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() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.kt new file mode 100644 index 00000000000..b1101e26349 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/13.fir.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() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.kt new file mode 100644 index 00000000000..182c25b3573 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/14.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.kt new file mode 100644 index 00000000000..053e181d1d9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/15.fir.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, KT-35668 + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.fir.kt new file mode 100644 index 00000000000..d5fbf589752 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/16.fir.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() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.kt new file mode 100644 index 00000000000..43f71ef5ba6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/17.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/18.fir.kt new file mode 100644 index 00000000000..a2561e18942 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/18.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.kt new file mode 100644 index 00000000000..42db1ca2d3c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/19.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.kt new file mode 100644 index 00000000000..7eb38019231 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/2.fir.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() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.kt new file mode 100644 index 00000000000..41a60f10fdb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/20.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.kt new file mode 100644 index 00000000000..96afa02eb9d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/21.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.kt new file mode 100644 index 00000000000..bc211e48839 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/22.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.kt new file mode 100644 index 00000000000..99a20bb91cb --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/23.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.kt new file mode 100644 index 00000000000..59eec1fcb88 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/24.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.fir.kt new file mode 100644 index 00000000000..276cfcf7818 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/25.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.kt new file mode 100644 index 00000000000..f8cdf88a36e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/26.fir.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?")!>x[if (true) {x=null;0} else 0] += & kotlin.collections.MutableList?")!>x[0] + & kotlin.collections.MutableList?")!>x + & kotlin.collections.MutableList?")!>x[0].inv() +} + +// TESTCASE NUMBER: 2 +fun case_2() { + var x: MutableList? = mutableListOf(1) + x!! + & kotlin.collections.MutableList?")!>x[if (true) {x=null;0} else 0] = & kotlin.collections.MutableList?")!>x[0] + & kotlin.collections.MutableList?")!>x + & kotlin.collections.MutableList?")!>x[0].inv() +} + +// TESTCASE NUMBER: 3 +fun case_3() { + var x: MutableList? = mutableListOf(1) + x!! + & kotlin.collections.MutableList?")!>x[0] = if (true) {x=null;0} else 0 + & kotlin.collections.MutableList?")!>x + & kotlin.collections.MutableList?")!>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>?")!>x[if (true) {x=null;0} else 0][> & kotlin.collections.MutableList>?")!>x[0][0]] += 10 + > & kotlin.collections.MutableList>?")!>x + > & kotlin.collections.MutableList>?")!>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>?")!>x[if (true) {x=null;0} else 0].addAll(1, > & kotlin.collections.MutableList>?")!>x[0]) +} + +// TESTCASE NUMBER: 9 +fun case_9() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].subList(0, 2)[> & kotlin.collections.MutableList>?")!>x[0][0]] +} + +/* + * TESTCASE NUMBER: 10 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_10() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?")!>x.subList(if (true) {x=null;0} else 0, 2)[> & kotlin.collections.MutableList>?")!>x[0][0]] +} + +/* + * TESTCASE NUMBER: 11 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-30507 + */ +fun case_11() { + var x: MutableList>? = mutableListOf(mutableListOf(1)) + x!! + > & kotlin.collections.MutableList>?")!>x[if (true) {x=null;0} else 0].subList(> & kotlin.collections.MutableList>?")!>x[0][0], 2) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.kt new file mode 100644 index 00000000000..e48f9995826 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/27.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.fir.kt new file mode 100644 index 00000000000..9ae7a8d876e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/28.fir.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<*>) { + & Inv & kotlin.collections.MutableList<*> & Inv")!>this + & Inv & kotlin.collections.MutableList<*> & Inv")!>this[0] = & Inv & kotlin.collections.MutableList<*> & Inv")!>this[1] + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.kt new file mode 100644 index 00000000000..bf513ef927b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/29.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.fir.kt new file mode 100644 index 00000000000..743903d0d49 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/3.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.kt new file mode 100644 index 00000000000..40f347ea31d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/30.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.fir.kt new file mode 100644 index 00000000000..1a88e50e60d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/31.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.fir.kt new file mode 100644 index 00000000000..26b4da2d181 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/32.fir.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, KT-35668 + */ +fun case_1(x: Int?) { + if (x == null) { + stringArg(x!!) + x + } +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-27464, KT-35668 + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.fir.kt new file mode 100644 index 00000000000..1c7e8304cf3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/33.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.kt new file mode 100644 index 00000000000..7fdb614f5c5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/34.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.kt new file mode 100644 index 00000000000..02f1817955c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/35.fir.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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.kt new file mode 100644 index 00000000000..537222c0993 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/36.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.kt new file mode 100644 index 00000000000..31cf8339fd0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/37.fir.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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.kt new file mode 100644 index 00000000000..9800adfc4ce --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/38.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.kt new file mode 100644 index 00000000000..79eb6437be9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/39.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.kt new file mode 100644 index 00000000000..8655f442af8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/4.fir.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 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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.kt new file mode 100644 index 00000000000..3ca805cd526 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.kt new file mode 100644 index 00000000000..fba491864b6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/41.fir.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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.kt new file mode 100644 index 00000000000..11acd8d9d4e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/42.fir.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) { + & kotlin.Any")!>x + & kotlin.Any")!>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?) { + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x?.toByte() + } +} + +/* + * TESTCASE NUMBER: 5 + * ISSUES: KT-1982 + */ +fun case_5(x: Any?) { + if (x is Int || x is Float) { + & kotlin.Any?")!>x + & kotlin.Any?")!>x.toByte() + } +} + +/* + * TESTCASE NUMBER: 6 + * ISSUES: KT-1982 + */ +fun case_6(x: T) { + if (x is Int || x is Float) { + & T!! & T")!>x + & T!! & T")!>x.toByte() + } +} + +/* + * TESTCASE NUMBER: 7 + * ISSUES: KT-1982 + */ +fun case_7(x: T) { + if (x is Int? || x is Float?) { + ? & T & T")!>x + ? & T & T")!>x.toByte() + } +} + +/* + * TESTCASE NUMBER: 8 + * ISSUES: KT-1982 + */ +inline fun case_8(x: T) { + if (x is Int? || x is Float?) { + ? & T & T")!>x + ? & T & T")!>x.toByte() + } +} + +/* + * TESTCASE NUMBER: 9 + * ISSUES: KT-1982 + */ +inline fun case_9(x: T) { + if (x is Int? || x is Float?) { + & T & T")!>x + & T & T")!>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 + & kotlin.Any")!>x + & kotlin.Any")!>x.toByte() +} + +/* + * TESTCASE NUMBER: 13 + * ISSUES: KT-1982 + */ +fun case_13(x: T) { + if (x !is Int && x !is Float) throw Exception() + & T!! & T")!>x + & T!! & T")!>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 { + & kotlin.Any")!>x + & kotlin.Any")!>x.inv() + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.kt new file mode 100644 index 00000000000..0102564876a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/43.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.fir.kt new file mode 100644 index 00000000000..3ca928364c1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/44.fir.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() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.kt new file mode 100644 index 00000000000..a6870188176 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/45.fir.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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.kt new file mode 100644 index 00000000000..b650c04a780 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/5.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.kt new file mode 100644 index 00000000000..b198da66b91 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/6.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.kt new file mode 100644 index 00000000000..a50b68b491a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/7.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.kt new file mode 100644 index 00000000000..78778c76671 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/8.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.kt new file mode 100644 index 00000000000..a483ad3dbe2 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/9.fir.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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt new file mode 100644 index 00000000000..5a818dd278e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/1.fir.kt @@ -0,0 +1,4215 @@ +// !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) { + a.B19.C19.D19 + a.B19.C19.D19.equals(null) + a.B19.C19.D19.propT + a.B19.C19.D19.propAny + a.B19.C19.D19.propNullableT + a.B19.C19.D19.propNullableAny + a.B19.C19.D19.funT() + a.B19.C19.D19.funAny() + a.B19.C19.D19.funNullableT() + 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) { + 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 && b !== null) { + 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 && b !== null) { + a( & kotlin.Function0?")!>b) + a(b) + & kotlin.Function0?")!>b.equals(null) + & kotlin.Function0?")!>b.propT + & kotlin.Function0?")!>b.propAny + & kotlin.Function0?")!>b.propNullableT + & kotlin.Function0?")!>b.propNullableAny + & kotlin.Function0?")!>b.funT() + & kotlin.Function0?")!>b.funAny() + & kotlin.Function0?")!>b.funNullableT() + & kotlin.Function0?")!>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 = y() + + if (z != null) { + 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 && b != null == true) { + val x = 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 + if (this.s != null) s + if (s != null || this.s != null) s + 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 + if (this.s != null) s + if (s != null || this.s != null) s + 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 + if (this.s != null) s + if (s != null || this.s != null) s + 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 + if (this.s != null) s + if (s != null || this.s != null) s + 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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.fir.kt new file mode 100644 index 00000000000..b109bc67cd8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/10.fir.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?")!>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() + 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?")!>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() + 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?")!>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() + 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?")!>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() + 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?")!>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() + 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?")!>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: 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?")!>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: 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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.fir.kt new file mode 100644 index 00000000000..9aa14903f75 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/11.fir.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) { + & kotlin.Number? & kotlin.Comparable?")!>x + & kotlin.Number? & kotlin.Comparable?")!>x.equals(null) + & kotlin.Number? & kotlin.Comparable?")!>x.propT + & kotlin.Number? & kotlin.Comparable?")!>x.propAny + & kotlin.Number? & kotlin.Comparable?")!>x.propNullableT + & kotlin.Number? & kotlin.Comparable?")!>x.propNullableAny + & kotlin.Number? & kotlin.Comparable?")!>x.funT() + & kotlin.Number? & kotlin.Comparable?")!>x.funAny() + & kotlin.Number? & kotlin.Comparable?")!>x.funNullableT() + & kotlin.Number? & kotlin.Comparable?")!>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) { + & kotlin.Number? & kotlin.Comparable?")!>x + & kotlin.Number? & kotlin.Comparable?")!>x.equals(null) + & kotlin.Number? & kotlin.Comparable?")!>x.propT + & kotlin.Number? & kotlin.Comparable?")!>x.propAny + & kotlin.Number? & kotlin.Comparable?")!>x.propNullableT + & kotlin.Number? & kotlin.Comparable?")!>x.propNullableAny + & kotlin.Number? & kotlin.Comparable?")!>x.funT() + & kotlin.Number? & kotlin.Comparable?")!>x.funAny() + & kotlin.Number? & kotlin.Comparable?")!>x.funNullableT() + & kotlin.Number? & kotlin.Comparable?")!>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 { + ?")!>this + if (this != null) { + & kotlin.Number & kotlin.Comparable")!>this + & kotlin.Number & kotlin.Comparable")!>this.equals(null) + & kotlin.Number & kotlin.Comparable")!>this.propT + & kotlin.Number & kotlin.Comparable")!>this.propAny + & kotlin.Number & kotlin.Comparable")!>this.propNullableT + & kotlin.Number & kotlin.Comparable")!>this.propNullableAny + & kotlin.Number & kotlin.Comparable")!>this.funT() + & kotlin.Number & kotlin.Comparable")!>this.funAny() + & kotlin.Number & kotlin.Comparable")!>this.funNullableT() + & kotlin.Number & kotlin.Comparable")!>this.funNullableAny() + } + }.let { + ?")!>it + if (it != null) { + & kotlin.Number? & kotlin.Comparable?")!>it + & kotlin.Number? & kotlin.Comparable?")!>it.equals(null) + & kotlin.Number? & kotlin.Comparable?")!>it.propT + & kotlin.Number? & kotlin.Comparable?")!>it.propAny + & kotlin.Number? & kotlin.Comparable?")!>it.propNullableT + & kotlin.Number? & kotlin.Comparable?")!>it.propNullableAny + & kotlin.Number? & kotlin.Comparable?")!>it.funT() + & kotlin.Number? & kotlin.Comparable?")!>it.funAny() + & kotlin.Number? & kotlin.Comparable?")!>it.funNullableT() + & kotlin.Number? & kotlin.Comparable?")!>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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.fir.kt new file mode 100644 index 00000000000..c1307463c23 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/12.fir.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")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>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: 25 +fun > InterfaceWithTypeParameter1?.case_25() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>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: 26 +fun > InterfaceWithTypeParameter1?.case_26() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 27 +fun > InterfaceWithTypeParameter1?.case_27() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 28 +fun > InterfaceWithTypeParameter1?.case_28() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 29 +fun > InterfaceWithTypeParameter1?.case_29() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 30 +fun > InterfaceWithTypeParameter1?.case_30() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 31 +fun > InterfaceWithTypeParameter1?.case_31() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 32 +fun Map?.case_32() { + if (this != null) { + & kotlin.collections.Map")!>this + & kotlin.collections.Map")!>this.equals(null) + & kotlin.collections.Map")!>this.propT + & kotlin.collections.Map")!>this.propAny + & kotlin.collections.Map")!>this.propNullableT + & kotlin.collections.Map")!>this.propNullableAny + & kotlin.collections.Map")!>this.funT() + & kotlin.collections.Map")!>this.funAny() + & kotlin.collections.Map")!>this.funNullableT() + & kotlin.collections.Map")!>this.funNullableAny() + & kotlin.collections.Map")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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")!>this + & InterfaceWithFiveTypeParameters1")!>this.equals(null) + & InterfaceWithFiveTypeParameters1")!>this.propT + & InterfaceWithFiveTypeParameters1")!>this.propAny + & InterfaceWithFiveTypeParameters1")!>this.propNullableT + & InterfaceWithFiveTypeParameters1")!>this.propNullableAny + & InterfaceWithFiveTypeParameters1")!>this.funT() + & InterfaceWithFiveTypeParameters1")!>this.funAny() + & InterfaceWithFiveTypeParameters1")!>this.funNullableT() + & InterfaceWithFiveTypeParameters1")!>this.funNullableAny() + & InterfaceWithFiveTypeParameters1")!>this.itest() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + itest() + 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() + } + 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")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 35 +fun InterfaceWithTypeParameter1?.case_35() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 36 +fun InterfaceWithTypeParameter1?.case_36() { + if (this != null) { + & InterfaceWithTypeParameter1")!>this + & InterfaceWithTypeParameter1")!>this.equals(null) + & InterfaceWithTypeParameter1")!>this.propT + & InterfaceWithTypeParameter1")!>this.propAny + & InterfaceWithTypeParameter1")!>this.propNullableT + & InterfaceWithTypeParameter1")!>this.propNullableAny + & InterfaceWithTypeParameter1")!>this.funT() + & InterfaceWithTypeParameter1")!>this.funAny() + & InterfaceWithTypeParameter1")!>this.funNullableT() + & InterfaceWithTypeParameter1")!>this.funNullableAny() + & InterfaceWithTypeParameter1")!>this.ip1test1() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + 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: 37 +fun Map?.case_37() { + if (this != null) { + & kotlin.collections.Map")!>this + & kotlin.collections.Map")!>this.equals(null) + & kotlin.collections.Map")!>this.propT + & kotlin.collections.Map")!>this.propAny + & kotlin.collections.Map")!>this.propNullableT + & kotlin.collections.Map")!>this.propNullableAny + & kotlin.collections.Map")!>this.funT() + & kotlin.collections.Map")!>this.funAny() + & kotlin.collections.Map")!>this.funNullableT() + & kotlin.collections.Map")!>this.funNullableAny() + & kotlin.collections.Map")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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>")!>this + & kotlin.collections.Map<*, out T>")!>this.equals(null) + & kotlin.collections.Map<*, out T>")!>this.propT + & kotlin.collections.Map<*, out T>")!>this.propAny + & kotlin.collections.Map<*, out T>")!>this.propNullableT + & kotlin.collections.Map<*, out T>")!>this.propNullableAny + & kotlin.collections.Map<*, out T>")!>this.funT() + & kotlin.collections.Map<*, out T>")!>this.funAny() + & kotlin.collections.Map<*, out T>")!>this.funNullableT() + & kotlin.collections.Map<*, out T>")!>this.funNullableAny() + & kotlin.collections.Map<*, out T>")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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")!>this + & InterfaceWithTwoTypeParameters")!>this.equals(null) + & InterfaceWithTwoTypeParameters")!>this.propT + & InterfaceWithTwoTypeParameters")!>this.propAny + & InterfaceWithTwoTypeParameters")!>this.propNullableT + & InterfaceWithTwoTypeParameters")!>this.propNullableAny + & InterfaceWithTwoTypeParameters")!>this.funT() + & InterfaceWithTwoTypeParameters")!>this.funAny() + & InterfaceWithTwoTypeParameters")!>this.funNullableT() + & InterfaceWithTwoTypeParameters")!>this.funNullableAny() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ")!>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() + } + } +} + +// TESTCASE NUMBER: 40 +fun InterfaceWithTwoTypeParameters?.case_40() { + if (this != null) { + & InterfaceWithTwoTypeParameters")!>this + & InterfaceWithTwoTypeParameters")!>this.equals(null) + & InterfaceWithTwoTypeParameters")!>this.propT + & InterfaceWithTwoTypeParameters")!>this.propAny + & InterfaceWithTwoTypeParameters")!>this.propNullableT + & InterfaceWithTwoTypeParameters")!>this.propNullableAny + & InterfaceWithTwoTypeParameters")!>this.funT() + & InterfaceWithTwoTypeParameters")!>this.funAny() + & InterfaceWithTwoTypeParameters")!>this.funNullableT() + & InterfaceWithTwoTypeParameters")!>this.funNullableAny() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ")!>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() + } + } +} + +// TESTCASE NUMBER: 41 +fun Map?.case_41() { + if (this != null) { + & kotlin.collections.Map")!>this + & kotlin.collections.Map")!>this.equals(null) + & kotlin.collections.Map")!>this.propT + & kotlin.collections.Map")!>this.propAny + & kotlin.collections.Map")!>this.propNullableT + & kotlin.collections.Map")!>this.propNullableAny + & kotlin.collections.Map")!>this.funT() + & kotlin.collections.Map")!>this.funAny() + & kotlin.collections.Map")!>this.funNullableT() + & kotlin.collections.Map")!>this.funNullableAny() + & kotlin.collections.Map")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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 Map?.case_42() { + if (this != null) { + & kotlin.collections.Map")!>this + & kotlin.collections.Map")!>this.equals(null) + & kotlin.collections.Map")!>this.propT + & kotlin.collections.Map")!>this.propAny + & kotlin.collections.Map")!>this.propNullableT + & kotlin.collections.Map")!>this.propNullableAny + & kotlin.collections.Map")!>this.funT() + & kotlin.collections.Map")!>this.funAny() + & kotlin.collections.Map")!>this.funNullableT() + & kotlin.collections.Map")!>this.funNullableAny() + & kotlin.collections.Map")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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")!>this + & kotlin.collections.Map")!>this.equals(null) + & kotlin.collections.Map")!>this.propT + & kotlin.collections.Map")!>this.propAny + & kotlin.collections.Map")!>this.propNullableT + & kotlin.collections.Map")!>this.propNullableAny + & kotlin.collections.Map")!>this.funT() + & kotlin.collections.Map")!>this.funAny() + & kotlin.collections.Map")!>this.funNullableT() + & kotlin.collections.Map")!>this.funNullableAny() + & kotlin.collections.Map")!>this.isEmpty() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + isEmpty() + apply { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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")!>this + & InterfaceWithFiveTypeParameters1")!>this.equals(null) + & InterfaceWithFiveTypeParameters1")!>this.propT + & InterfaceWithFiveTypeParameters1")!>this.propAny + & InterfaceWithFiveTypeParameters1")!>this.propNullableT + & InterfaceWithFiveTypeParameters1")!>this.propNullableAny + & InterfaceWithFiveTypeParameters1")!>this.funT() + & InterfaceWithFiveTypeParameters1")!>this.funAny() + & InterfaceWithFiveTypeParameters1")!>this.funNullableT() + & InterfaceWithFiveTypeParameters1")!>this.funNullableAny() + & InterfaceWithFiveTypeParameters1")!>this.itest() + + equals(null) + + propT + + propAny + + propNullableT + + propNullableAny + + funT() + + funAny() + + funNullableT() + + funNullableAny() + itest() + 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() + } + 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() + } + } + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt new file mode 100644 index 00000000000..4a2b59d7b0f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/13.fir.kt @@ -0,0 +1,4367 @@ +// !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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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?")!>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 { + ")!>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: 25 +fun > case_25(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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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 { + ")!>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.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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>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: 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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>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: 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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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: 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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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 { + ")!>this + equals(null) + propT + propAny + propNullableT + propNullableAny + funT() + funAny() + funNullableT() + funNullableAny() + isEmpty() + ")!>this.equals(null) + ")!>this.propT + ")!>this.propAny + ")!>this.propNullableT + ")!>this.propNullableAny + ")!>this.funT() + ")!>this.funAny() + ")!>this.funNullableT() + ")!>this.funNullableAny() + ")!>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 { + ")!>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.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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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() + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt new file mode 100644 index 00000000000..87d41ee129f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/14.fir.kt @@ -0,0 +1,61 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 14 + * DESCRIPTION: Raw data flow analysis test + */ + +// TESTCASE NUMBER: 1 +fun case_1(vararg x: Int?) { + if (x != null) { + x + x[0] + } +} + +// TESTCASE NUMBER: 2 +fun case_2(vararg x: Int?) { + x[0].apply { + if (this != null) { + this + this.inv() + } + } + + x[0].also { + if (it != null) { + it + it.inv() + } + } +} + +// TESTCASE NUMBER: 3 +fun case_3(vararg x: T?) { + if (x != null) { + & kotlin.Array")!>x + x[0] + } +} + +// TESTCASE NUMBER: 4 +fun case_4(vararg x: T?) { + x[0].apply { + if (this != null) { + this + this.toByte() + } + } + + x[0].also { + if (it != null) { + it + it.toByte() + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt new file mode 100644 index 00000000000..50b2e14ae80 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/15.fir.kt @@ -0,0 +1,199 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 15 + * DESCRIPTION: Raw data flow analysis test + * NOTE: performance test + * HELPERS: classes, interfaces, functions, properties + */ + +// TESTCASE NUMBER: 1 +open class Case1_1 : InterfaceWithTypeParameter1 +open class Case1_2 : InterfaceWithTypeParameter1 + +fun case_1() { + val a = select(Case1_1(), Case1_2(), null) + + if (a != null) { + & InterfaceWithTypeParameter1<*>?")!>a + val b = & InterfaceWithTypeParameter1<*>?")!>a.ip1test1() + 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: 2 +class Case2_1 : Interface3, InterfaceWithTypeParameter1 +class Case2_2 : Interface3, InterfaceWithTypeParameter1 + +fun case_2() { + val x = select(Case2_1(), Case2_2(), null) + + if (x != null) { + >>>> & Interface3? & InterfaceWithTypeParameter1>>>>?")!>x + >>>> & Interface3? & InterfaceWithTypeParameter1>>>>?")!>x.ip1test1() + } +} + +// TESTCASE NUMBER: 3 +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>>>> & 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() + } +} + +// TESTCASE NUMBER: 4 +class Case4_1 : InterfaceWithTypeParameter1, InterfaceWithTypeParameter2 +class Case4_2 : InterfaceWithTypeParameter1, InterfaceWithTypeParameter2 + +fun case_4() { + val x = select(Case4_1(), Case4_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>>>> & 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>>>> & 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>>>> & 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() + } +} + +// TESTCASE NUMBER: 5 +class Case5_1 : InterfaceWithTypeParameter1>, InterfaceWithTypeParameter2> +class Case5_2 : InterfaceWithTypeParameter2>, InterfaceWithTypeParameter1> + +fun case_5() { + val x = select(Case5_1(), Case5_2(), null) + + if (x != null) { + > & InterfaceWithTypeParameter2> & InterfaceWithTypeParameter1>? & InterfaceWithTypeParameter2>?")!>x + > & InterfaceWithTypeParameter2> & InterfaceWithTypeParameter1>? & InterfaceWithTypeParameter2>?")!>x.ip1test1() + > & InterfaceWithTypeParameter2> & InterfaceWithTypeParameter1>? & InterfaceWithTypeParameter2>?")!>x.ip1test2() + } +} + +// TESTCASE NUMBER: 6 +class Case6_1 : InterfaceWithTypeParameter1>, InterfaceWithTypeParameter2>> +class Case6_2 : InterfaceWithTypeParameter2>>, InterfaceWithTypeParameter1> + +fun case_6() { + val x = select(Case6_1(), Case6_2(), null) + + if (x != null) { + >> & InterfaceWithTypeParameter2>> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2>>>> & InterfaceWithTypeParameter1>>? & InterfaceWithTypeParameter2>> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2>>>>?")!>x + >> & InterfaceWithTypeParameter2>> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2>>>> & InterfaceWithTypeParameter1>>? & InterfaceWithTypeParameter2>> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2>>>>?")!>x.ip1test1() + >> & InterfaceWithTypeParameter2>> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2>>>> & InterfaceWithTypeParameter1>>? & InterfaceWithTypeParameter2>> & InterfaceWithTypeParameter2 & InterfaceWithTypeParameter2>>>>?")!>x.ip1test2() + } +} + +// TESTCASE NUMBER: 7 +open class Case7_1 : InterfaceWithTwoTypeParameters, Inv> +open class Case7_2 : InterfaceWithTwoTypeParameters, Inv> + +fun case_7() { + val x = select(Case7_1(), Case7_2(), null) + + if (x != null) { + & java.io.Serializable>, out Inv & java.io.Serializable>> & InterfaceWithTwoTypeParameters & java.io.Serializable>, out Inv & java.io.Serializable>>?")!>x + & java.io.Serializable>, out Inv & java.io.Serializable>> & InterfaceWithTwoTypeParameters & java.io.Serializable>, out Inv & java.io.Serializable>>?")!>x.ip2test() + } +} + +// TESTCASE NUMBER: 8 +open class Case8_1 : ClassWithTwoTypeParameters, K>() +open class Case8_2 : ClassWithTwoTypeParameters, T>() + +fun case_8() { + val x = select(Case8_1(), Case8_2(), null) + + if (x != null) { + & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>, out kotlin.Comparable & java.io.Serializable> & ClassWithTwoTypeParameters & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>, out kotlin.Comparable & java.io.Serializable>?")!>x + & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>, out kotlin.Comparable & java.io.Serializable> & ClassWithTwoTypeParameters & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>, out kotlin.Comparable & java.io.Serializable>?")!>x.test1() + val y = & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>, out kotlin.Comparable & java.io.Serializable> & ClassWithTwoTypeParameters & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>, out kotlin.Comparable & java.io.Serializable>?")!>x.test2() + if (y != null) { + & java.io.Serializable, out kotlin.Comparable & java.io.Serializable> & ClassWithTwoTypeParameters & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>?")!>y + & java.io.Serializable, out kotlin.Comparable & java.io.Serializable> & ClassWithTwoTypeParameters & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>?")!>y.test1() + val z = & java.io.Serializable, out kotlin.Comparable & java.io.Serializable> & ClassWithTwoTypeParameters & java.io.Serializable, out kotlin.Comparable & java.io.Serializable>?")!>y.test2() + if (z != null) { + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.equals(null) + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.propT + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.propAny + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.propNullableT + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.propNullableAny + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.funT() + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.funAny() + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.funNullableT() + & java.io.Serializable & kotlin.Comparable? & java.io.Serializable?")!>z.funNullableAny() + } + } + } +} + +// TESTCASE NUMBER: 9 +open class Case9_1 : ClassWithTwoTypeParameters, Case9_2>() +open class Case9_2 : ClassWithTwoTypeParameters, Case9_1>() + +fun case_9() { + val x = select(Case9_1(), Case9_2(), null) + + if (x != null) { + & ClassWithTwoTypeParameters<*, *>?")!>x + & ClassWithTwoTypeParameters<*, *>?")!>x.test1() + val y = x.test2() + if (y != null) { + y + y + y.equals(null) + y.propT + y.propAny + y.propNullableT + y.propNullableAny + y.funT() + y.funAny() + y.funNullableT() + y.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 10 +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) { + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.equals(null) + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.propT + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.propAny + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.propNullableT + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.propNullableAny + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.funT() + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.funAny() + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.funNullableT() + >>>> & Interface3? & InterfaceWithOutParameter>>>>?")!>x.funNullableAny() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.kt new file mode 100644 index 00000000000..2583a21dcc8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/16.fir.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?")!>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: 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 + ?")!>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(x: Collection>>>>>>?) { + 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: 17 +fun case_17(x: MutableMap<*, *>?) { + if (x === implicitNullableNothingProperty || false) { return } + ?")!>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: MutableMap?) { + if (false || false || false || x == nullableNothingProperty) return + ?")!>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(x: Inv>>>>>>?) { + if (x === implicitNullableNothingProperty && true) else { return } + >>>>>>?")!>x + >>>>>>?")!>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 + ?")!>x + ?")!>x.equals(null) + ?")!>x.propT + ?")!>x.propAny + ?")!>x.propNullableT + ?")!>x.propNullableAny + ?")!>x.funT() + ?")!>x.funAny() + ?")!>x.funNullableT() + ?")!>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 + ?")!>x + ?")!>x.equals(null) + ?")!>x.propT + ?")!>x.propAny + ?")!>x.propNullableT + ?")!>x.propNullableAny + ?")!>x.funT() + ?")!>x.funAny() + ?")!>x.funNullableT() + ?")!>x.funNullableAny() + })() +} + +// TESTCASE NUMBER: 40 +fun case_40(x: Collection>>>>>>?) { + val z = (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: 41 +fun case_41(x: MutableMap<*, *>?) { + listOf(l@ { + if (x === implicitNullableNothingProperty || 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: 42 +fun case_42(x: MutableMap?) { + return (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: 43 +fun case_43(x: Inv>>>>>>?): Any? { + return l@ { + if (x === implicitNullableNothingProperty && true) else { return@l } + >>>>>>?")!>x + >>>>>>?")!>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 + ?")!>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/17.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.kt new file mode 100644 index 00000000000..fbf70fb5eec --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/17.fir.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?")!>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: 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() + ?")!>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(x: Collection>>>>>>?) { + 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: 17 +fun case_17(x: MutableMap<*, *>?) { + if (x === implicitNullableNothingProperty || 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: 18 +fun case_18(x: MutableMap?) { + if (false || false || false || x == nullableNothingProperty) throw Exception() + ?")!>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(x: Inv>>>>>>?) { + if (x === implicitNullableNothingProperty && true) else { throw Exception() } + >>>>>>?")!>x + >>>>>>?")!>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() + ?")!>x + ?")!>x.equals(null) + ?")!>x.propT + ?")!>x.propAny + ?")!>x.propNullableT + ?")!>x.propNullableAny + ?")!>x.funT() + ?")!>x.funAny() + ?")!>x.funNullableT() + ?")!>x.funNullableAny() +} + +// TESTCASE NUMBER: 25 +fun case_25(x: Inv?, y: Nothing?) { + if (x !== y) else try { throw Exception() } finally { throw Exception() } + ?")!>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/18.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.kt new file mode 100644 index 00000000000..ba72f2e6cf0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/18.fir.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 + ?")!>x + ?")!>x.equals(null) + ?")!>x.propT + ?")!>x.propAny + ?")!>x.propNullableT + ?")!>x.propNullableAny + ?")!>x.funT() + ?")!>x.funAny() + ?")!>x.funNullableT() + ?")!>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 + } + ?")!>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/19.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.fir.kt new file mode 100644 index 00000000000..e8727ff2cf3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/19.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.kt new file mode 100644 index 00000000000..18dbc4a1cd8 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/2.fir.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() + ?")!>y.equals(null) + ?")!>y.propT + ?")!>y.propAny + ?")!>y.propNullableT + ?")!>y.propNullableAny + ?")!>y.funT() + ?")!>y.funAny() + ?")!>y.funNullableT() + ?")!>y.funNullableAny() + + if (z != null || false) { + 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 = a(b) + ?")!>a.equals(null) + ?")!>a.propT + ?")!>a.propAny + ?")!>a.propNullableT + ?")!>a.propNullableAny + ?")!>a.funT() + ?")!>a.funAny() + ?")!>a.funNullableT() + ?")!>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() + ?")!>y.equals(null) + ?")!>y.propT + ?")!>y.propAny + ?")!>y.propNullableT + ?")!>y.propNullableAny + ?")!>y.funT() + ?")!>y.funAny() + ?")!>y.funNullableT() + ?")!>y.funNullableAny() + + if (z != null || b) { + + } else { + 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 = a(b) + ?")!>a.equals(null) + ?")!>a.propT + ?")!>a.propAny + ?")!>a.propNullableT + ?")!>a.propNullableAny + ?")!>a.funT() + ?")!>a.funAny() + ?")!>a.funNullableT() + ?")!>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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.fir.kt new file mode 100644 index 00000000000..f3969c2864a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/20.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.fir.kt new file mode 100644 index 00000000000..d772706c915 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/21.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.fir.kt new file mode 100644 index 00000000000..998ddbfa62a --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/22.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.fir.kt new file mode 100644 index 00000000000..b38bd96cdf3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/23.fir.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) + } + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.kt new file mode 100644 index 00000000000..ec07bb55394 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/24.fir.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) + } + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt new file mode 100644 index 00000000000..9551a628d17 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/25.fir.kt @@ -0,0 +1,78 @@ +// !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 + * UNEXPECTED BEHAVIOUR + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt new file mode 100644 index 00000000000..cde4fb68fe1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/26.fir.kt @@ -0,0 +1,78 @@ +// !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 + * UNEXPECTED BEHAVIOUR + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt new file mode 100644 index 00000000000..f592fbdc745 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/27.fir.kt @@ -0,0 +1,78 @@ +// !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 + * UNEXPECTED BEHAVIOUR + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.fir.kt new file mode 100644 index 00000000000..2a80d4ba66b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/28.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.fir.kt new file mode 100644 index 00000000000..9d81fd591b3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/29.fir.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 { + x.prop_1.prop_1.prop_1.prop_1 + 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) { + 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/3.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt new file mode 100644 index 00000000000..d1935c45e15 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/3.fir.kt @@ -0,0 +1,311 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 3 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, enumClasses, classes, properties, typealiases + */ + +// FILE: other_package.kt + +package otherpackage + +// TESTCASE NUMBER: 13, 14 +class EmptyClass13_14 {} + +// FILE: main.kt + +import otherpackage.* + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x == null) { + x + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Nothing?) { + if (x == null) { + x + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + if (Object.prop_1 != null) + else { + Object.prop_1 + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Char?) { + if (x == null && true) { + x + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Unit? = null + + if (x == null) x +} + +// TESTCASE NUMBER: 6 +fun case_6(x: EmptyClass?) { + val y = true + + if (x == null && !y) { + x + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + if (nullableStringProperty == null || nullableStringProperty == null) { + nullableStringProperty + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: TypealiasNullableString) { + if (x == null && x == null) + x +} + +/* + * TESTCASE NUMBER: 9 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_9(x: TypealiasNullableString?) { + if (true && true && true && true && x !== null) { + + } else if (false) { + x + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + val a = Class() + + if (a.prop_4 != null || true) { + if (a.prop_4 == null) { + a.prop_4 + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: TypealiasNullableString?, y: TypealiasNullableString) { + val z: TypealiasNullableString = null + + if (x != null) { + + } else { + if (y == null) { + if (nullableStringProperty != null) { + if (z == null) { + x + } + } + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: TypealiasNullableString, y: TypealiasNullableString) = if (x != null && true && true && true) "1" + else if (y != null) x + else "-1" + +// TESTCASE NUMBER: 13 +fun case_13(x: otherpackage.EmptyClass13_14?) = + if (x != null && true) { + throw Exception() + } else x + +// TESTCASE NUMBER: 14 +class Case14 { + val x: otherpackage.EmptyClass13_14? + init { + x = otherpackage.EmptyClass13_14() + } +} + +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 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: TypealiasNullableString) { + val t = if (x != null) "" else { + x + } +} + +// TESTCASE NUMBER: 16 +fun case_16() { + val x: TypealiasNullableNothing = null + + if (x == null || false || false || false) { + x + } +} + +// TESTCASE NUMBER: 17 +val case_17 = if (nullableIntProperty !== null) 0 else { + nullableIntProperty +} + +//TESTCASE NUMBER: 18 +fun case_18(a: DeepObject.A.B.C.D.E.F.G.J?) { + if (a == null) { + 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 + } +} + +// 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) { + a.B19.C19.D19 + } +} + +// TESTCASE NUMBER: 21 +fun case_21() { + if (EnumClassWithNullableProperty.B.prop_1 == null) { + EnumClassWithNullableProperty.B.prop_1 + } +} + +// TESTCASE NUMBER: 22 +fun case_22(a: (() -> Unit)?) { + if (a == null) { + ?")!>a + } +} + +// TESTCASE NUMBER: 23 +fun case_23(a: ((Float) -> Int?)?, b: Float?) { + if (a == null && b == null) { + ?")!>a + b + if (a != null) { + & kotlin.Function1?")!>a + } + } +} + +/* + * TESTCASE NUMBER: 24 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_24(a: ((() -> Unit) -> Unit)?, b: (() -> Unit)?) { + if (false || false || a == null && b === null) { + , kotlin.Unit>?")!>a + ?")!>b + } +} + +// 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 = y() + + if (z == null) { + z + } + } +} + +// TESTCASE NUMBER: 26 +fun case_26(a: Int?, b: Int? = if (a !== null) 0 else a) { + a + b +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.kt new file mode 100644 index 00000000000..8c5d406e8e9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/30.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.kt new file mode 100644 index 00000000000..dc6ffe60c16 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/31.fir.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 { + x.prop_1.prop_1.prop_1.prop_1 + 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) { + 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/32.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.fir.kt new file mode 100644 index 00000000000..f4ab04c274f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/32.fir.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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt new file mode 100644 index 00000000000..05c3059e635 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/33.fir.kt @@ -0,0 +1,99 @@ +// !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 + } + + & kotlin.Any?")!>x + & kotlin.Any?")!>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 + * ISSUES: KT-35668 + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.fir.kt new file mode 100644 index 00000000000..bee15a42a7d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/34.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.kt new file mode 100644 index 00000000000..b5dc08d0653 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/35.fir.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, KT-35668 + */ +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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.fir.kt new file mode 100644 index 00000000000..b18d0a35e14 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/36.fir.kt @@ -0,0 +1,204 @@ +// !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 + * ISSUES: KT-35668 + */ +fun case_6(x: Any?) { + var y = x ?: null!! + while (false || y is Number) { + x + y + y.toByte() + } +} + +/* + * TESTCASE NUMBER: 7 + * ISSUES: KT-35668 + */ +fun case_7(x: Any?, z: Any) { + var y = x ?: null!! + while (false || y === z) { + x + y + y.equals(10) + } +} + +/* + * TESTCASE NUMBER: 8 + * ISSUES: KT-35668 + */ +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: 6 + * ISSUES: KT-35668 + */ +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() + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.kt new file mode 100644 index 00000000000..74e741238b7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/37.fir.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, KT-35668 + */ +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() +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.kt new file mode 100644 index 00000000000..dbb8537213d --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/38.fir.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<*, *>?) { + ? & ClassWithThreeTypeParameters<*, *, *>? & ClassWithThreeTypeParameters<*, *, *>?")!>x + ? & ClassWithThreeTypeParameters<*, *, *>? & ClassWithThreeTypeParameters<*, *, *>?")!>x?.x + x?.y + x?.z + & ClassWithThreeTypeParameters<*, *, *>")!>x!!.ip2test() + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>?")!>x + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>?")!>x.x + } +} + +// TESTCASE NUMBER: 3 +fun case_3(x: ClassWithThreeTypeParameters<*, *, *>) { + if (x is InterfaceWithTwoTypeParameters<*, *>?) { + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>")!>x + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>")!>x.x + x.y + x.z + & ClassWithThreeTypeParameters<*, *, *>")!>x!!.ip2test() + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>")!>x + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>")!>x.x + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: ClassWithSixTypeParameters<*, *, *, *, *, *>?) { + if (x is InterfaceWithTwoTypeParameters<*, *>) { + & ClassWithSixTypeParameters<*, *, *, *, *, *> & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>x + & ClassWithSixTypeParameters<*, *, *, *, *, *> & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>x.x + x.y + x.z + x.u + & ClassWithSixTypeParameters<*, *, *, *, *, *>")!>x!!.ip2test() + & ClassWithSixTypeParameters<*, *, *, *, *, *> & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>x + & ClassWithSixTypeParameters<*, *, *, *, *, *> & ClassWithSixTypeParameters<*, *, *, *, *, *>?")!>x.x + } +} + +// TESTCASE NUMBER: 5 +fun case_5(x: ClassWithThreeTypeParameters<*, *, *>?) { + if (x is InterfaceWithTwoTypeParameters<*, *>?) { + if (x === null) return + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>?")!>x + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>?")!>x.x + x.y + x.z + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>?")!>x.ip2test() + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>?")!>x + & ClassWithThreeTypeParameters<*, *, *> & ClassWithThreeTypeParameters<*, *, *>?")!>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?")!>x + & InterfaceWithTwoTypeParameters<*, *> & kotlin.Any?")!>x.x + x.y + x.z + & InterfaceWithTwoTypeParameters<*, *> & kotlin.Any?")!>x.ip2test() + & InterfaceWithTwoTypeParameters<*, *> & kotlin.Any?")!>x + & InterfaceWithTwoTypeParameters<*, *> & kotlin.Any?")!>x.x + } + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.kt new file mode 100644 index 00000000000..8f918cff636 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/39.fir.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/notLinked/dfa/pos/4.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt new file mode 100644 index 00000000000..085cc836e5b --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/4.fir.kt @@ -0,0 +1,297 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 4 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: objects, enumClasses, classes, properties, typealiases + */ + +// FILE: other_package.kt + +package otherpackage + +// TESTCASE NUMBER: 13 +class EmptyClass13 {} + +// TESTCASE NUMBER: 14 +typealias TypealiasString14 = String + +// FILE: main.kt + +import otherpackage.* + +// TESTCASE NUMBER: 1 +fun case_1(x: Any) { + if (x === null) { + x + } +} + +// TESTCASE NUMBER: 2 +fun case_2(x: Nothing) { + if (x == null) { + x + } +} + +// TESTCASE NUMBER: 3 +fun case_3() { + if (Object.prop_2 != null) + else { + Object.prop_2 + } +} + +// TESTCASE NUMBER: 4 +fun case_4(x: Char) { + if (x == null && true) { + x + } +} + +// TESTCASE NUMBER: 5 +fun case_5() { + val x: Unit = kotlin.Unit + + if (x == null) x +} + +// TESTCASE NUMBER: 6 +fun case_6(x: EmptyClass) { + val y = true + + if (x == null && !y) { + x + } +} + +// TESTCASE NUMBER: 7 +fun case_7() { + if (anonymousTypeProperty == null || anonymousTypeProperty == null) { + anonymousTypeProperty + } +} + +// TESTCASE NUMBER: 8 +fun case_8(x: TypealiasString) { + if (x == null && x == null) x +} + +// TESTCASE NUMBER: 9 +fun case_9(x: TypealiasString) { + if (x != null) { + + } else if (false) { + x + } +} + +// TESTCASE NUMBER: 10 +fun case_10() { + val a = Class() + + if (a.prop_5 != null || true) { + if (a.prop_5 == null) { + a.prop_5 + } + } +} + +// TESTCASE NUMBER: 11 +fun case_11(x: TypealiasString, y: TypealiasString) { + val z: TypealiasString = TypealiasString() + + if (x != null) { + + } else { + if (y == null) { + if (stringProperty != null) { + if (false || false || false || z == null || false) { + x + } + } + } + } +} + +// TESTCASE NUMBER: 12 +fun case_12(x: TypealiasString, y: TypealiasString) = if (x != null) "1" + else if (y !== null) x + else "-1" + +// TESTCASE NUMBER: 13 +fun case_13(x: otherpackage.EmptyClass13) = + if (x != null) { + 1 + } else x + +// TESTCASE NUMBER: 14 +class A14 { + val x: otherpackage.TypealiasString14 + init { + x = otherpackage.TypealiasString14() + } +} + +fun case_14() { + val a = A14() + + 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 + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 15 +fun case_15(x: TypealiasString) { + val t = if (true && x != null) "" else { + x + } +} + +// TESTCASE NUMBER: 16 +fun case_16() { + val x: TypealiasNothing = return + + if (x == null) { + x + } +} + +/* + * TESTCASE NUMBER: 17 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +val case_17 = if (true && true && intProperty != null) 0 else { + intProperty +} + +//TESTCASE NUMBER: 18 +fun case_18(a: DeepObject.A.B.C.D.E.F.G.J) { + if (a == null) { + 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 + } +} + +// TESTCASE NUMBER: 20 +fun case_20() { + val a = object { + val B19 = object { + val C19 = object { + val D19 = object {} + } + } + } + + if (a.B19.C19.D19 === null) { + a.B19.C19.D19 + } +} + +// TESTCASE NUMBER: 21 +fun case_21() { + if (EnumClassWithProperty.B.prop_1 == null || false || false || false || false || false || false || false) { + EnumClassWithProperty.B.prop_1 + } +} + +// TESTCASE NUMBER: 22 +fun case_22(a: (() -> Unit)) { + if (a == null) { + a() + } +} + +// TESTCASE NUMBER: 23 +fun case_23(a: ((Float) -> Int), b: Float) { + if (a == null && b == null) { + val x = a(b) + if (x !== null) { + x + } + } +} + +/* + * TESTCASE NUMBER: 24 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28329 + */ +fun case_24(a: ((() -> Unit) -> Unit), b: (() -> Unit)) { + if (false || false || a == null && b === null) { + , kotlin.Unit>")!>a + ")!>b + } +} + +// TESTCASE NUMBER: 25 +fun case_25(a: (() -> Unit) -> Unit, b: (() -> Unit) -> Unit = if (a == null) , kotlin.Unit>")!>a else {{}}) { + , kotlin.Unit>")!>a + , kotlin.Unit>")!>b +} + +// TESTCASE NUMBER: 26 +fun case_26(a: Int, b: Int = if (a === null) a else 0) { + a + b +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt new file mode 100644 index 00000000000..8d22b291015 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/40.fir.kt @@ -0,0 +1,176 @@ +// !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 + * UNEXPECTED BEHAVIOUR + */ +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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.kt new file mode 100644 index 00000000000..1b35f72b2cf --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/41.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.fir.kt new file mode 100644 index 00000000000..3bb82b4b989 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/42.fir.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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.kt new file mode 100644 index 00000000000..45fe2afc787 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/43.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.fir.kt new file mode 100644 index 00000000000..b9d7e4d5db0 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/44.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.fir.kt new file mode 100644 index 00000000000..98d85f0bc57 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/45.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.kt new file mode 100644 index 00000000000..ab55741aff6 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/46.fir.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) { + & kotlin.reflect.KClass?")!>x + & kotlin.reflect.KClass?")!>x.java + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.kt new file mode 100644 index 00000000000..190fe4d057f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/47.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.kt new file mode 100644 index 00000000000..d39e1506330 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/48.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.kt new file mode 100644 index 00000000000..4ffc16582da --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/49.fir.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/notLinked/dfa/pos/5.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.fir.kt new file mode 100644 index 00000000000..5254ac822b4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/5.fir.kt @@ -0,0 +1,391 @@ +// !LANGUAGE: +NewInference +// !DIAGNOSTICS: -UNUSED_EXPRESSION +// SKIP_TXT + +/* + * KOTLIN DIAGNOSTICS NOT LINKED SPEC TEST (POSITIVE) + * + * SECTIONS: dfa + * NUMBER: 5 + * DESCRIPTION: Raw data flow analysis test + * HELPERS: classes, interfaces, properties, functions + */ + +// TESTCASE NUMBER: 1 +fun case_1(x: Any?) { + if (x is Number?) { + 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(x: Any?) { + if (x is Number? && x is Int? && 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(x: Any?) { + if (x is Number?) { + if (x !== null) { + 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: 4 +fun case_4(x: Any?) { + if (x != null) { + 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: 5 +fun case_5(x: Any?) { + if (x is ClassLevel1?) { + if (x is ClassLevel2?) { + if (x is ClassLevel3?) { + if (x is ClassLevel4?) { + if (x is ClassLevel5?) { + if (x != null) { + 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() + x.test4() + x.test5() + } + } + } + } + } + } +} + +// TESTCASE NUMBER: 6 +fun case_6(x: Any?) { + if (x is ClassLevel1?) { + if (x is ClassLevel2?) { + if (x is ClassLevel3?) { + if (x != null && 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() + x.test1() + x.test2() + x.test3() + x.test4() + x.test5() + } + } + } + } + } +} + +// TESTCASE NUMBER: 7 +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(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test1() + x.test2() + x.test3() + x.test4() + x.test5() + } + } +} + +// TESTCASE NUMBER: 8 +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(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test1() + x.test2() + x.test3() + x.test4() + x.test5() + } + } +} + +// TESTCASE NUMBER: 9 +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(null) + x.propT + x.propAny + x.propNullableT + x.propNullableAny + x.funT() + x.funAny() + x.funNullableT() + x.funNullableAny() + x.test1() + x.test2() + x.test3() + x.test4() + x.test5() + } +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + if (x is ClassLevel1? && x is ClassLevel2? && x is ClassLevel3?) { + if (x is ClassLevel4?) { + + } else if (x is ClassLevel5? && x != null) { + 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() + x.test4() + x.test5() + } + } else if (x is ClassLevel4? && x != null && x is ClassLevel5?) { + 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() + x.test4() + x.test5() + } +} + +/* + * TESTCASE NUMBER: 11 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_11(x: Any?) { + if (x is Interface1?) { + if (x is Interface2?) { + if (x != null) { + x + x.itest1() + x.itest2() + + x.let { it.itest1(); it.itest2() } + } + } + } +} + +/* + * TESTCASE NUMBER: 12 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_12(x: Any?) { + if (x is Interface1? && x != null && x is Interface2?) { + x + x.itest1() + x.itest2() + + x.let { it.itest1(); it.itest2() } + } +} + +/* + * TESTCASE NUMBER: 13 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_13(x: Any?) { + if (x is Interface2?) { + if (x is ClassLevel1?) { + if (x is ClassLevel2? && x is Interface1?) { + if (x !is Interface3?) {} else if (false) { + if (x != null) { + x + x.itest1() + x.itest2() + x.itest3() + x.test1() + x.test2() + } + } + } + } + } +} + +/* + * TESTCASE NUMBER: 14 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_14(x: Any?) { + if (x is Interface2?) { + if (x is ClassLevel1?) { + if (x == null || x !is Interface1?) else { + if (x is ClassLevel2?) { + if (x is Interface3?) { + x + x.itest1() + x.itest2() + x.itest3() + x.test1() + x.test2() + } + } + } + } + } +} + +/* + * TESTCASE NUMBER: 15 + * NOTE: lazy smartcasts + * DISCUSSION + * ISSUES: KT-28362 + */ +fun case_15(x: Any?) { + if (x !is ClassLevel2? || x !is ClassLevel1?) else { + if (x === null || x !is Interface1?) else { + if (x !is Interface2? || x !is Interface3?) {} else { + x + x.itest2() + x.itest1() + x.itest3() + x.test1() + x.test2() + } + } + } +} + +// TESTCASE NUMBER: 16 +fun case_16(a: Any?, b: Int = if (a is Number? && a is Int? && 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: 17 +fun case_17(a: Any?, b: Int = if (a !is Number? || a !is Int? || a == null) 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/50.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.kt new file mode 100644 index 00000000000..bfd2b03f097 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/50.fir.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: 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<*>) { + & Inv<*>")!>this.test() + & Inv<*>")!>this.prop_4 + & Inv<*>")!>this.prop_4.inv() + prop_4 + prop_4.inv() + } +} + +// TESTCASE NUMBER: 2 +fun Any.case_2() { + if (this is ClassWithSixTypeParameters<*, *, *, *, *, *>) { + & ClassWithSixTypeParameters<*, *, *, *, *, *>")!>this.test() + & ClassWithSixTypeParameters<*, *, *, *, *, *>")!>this.x + & ClassWithSixTypeParameters<*, *, *, *, *, *>")!>this.y + x + y + } +} + +// TESTCASE NUMBER: 3 +fun T.case_3() { + if (this is Inv<*>) { + & T!! & Inv<*> & T!!")!>this.test() + & T!! & Inv<*> & T!!")!>this.prop_4 + & T!! & Inv<*> & T!!")!>this.prop_4.inv() + prop_4 + prop_4.inv() + } +} + +// TESTCASE NUMBER: 4 +fun T?.case_4() { + if (this is ClassWithSixTypeParameters<*, *, *, *, *, *>) { + & T?!! & ClassWithSixTypeParameters<*, *, *, *, *, *> & T?!!")!>this.test() + & T?!! & ClassWithSixTypeParameters<*, *, *, *, *, *> & T?!!")!>this.x + & T?!! & ClassWithSixTypeParameters<*, *, *, *, *, *> & T?!!")!>this.y + x + y + } +} + +// TESTCASE NUMBER: 5 +fun ClassWithSixTypeParameters.case_5() { + if (this is InterfaceWithFiveTypeParameters1<*, *, *, *, *>) { + & ClassWithSixTypeParameters & InterfaceWithFiveTypeParameters1<*, *, *, *, *> & ClassWithSixTypeParameters")!>this.itest1() + itest1() + & ClassWithSixTypeParameters & InterfaceWithFiveTypeParameters1<*, *, *, *, *> & ClassWithSixTypeParameters")!>this.test() + & ClassWithSixTypeParameters & InterfaceWithFiveTypeParameters1<*, *, *, *, *> & ClassWithSixTypeParameters")!>this.x + & ClassWithSixTypeParameters & InterfaceWithFiveTypeParameters1<*, *, *, *, *> & ClassWithSixTypeParameters")!>this.y + x + y + } +} + +/* + * TESTCASE NUMBER: 6 + * ISSUES: KT-25432 + */ +fun case_6(y: Inv) { + if (y.prop_3 is MutableList<*>) { + y.prop_3 + y.prop_3[0] + } +} + +/* + * TESTCASE NUMBER: 7 + * ISSUES: KT-25432 + */ +fun Inv.case_7() { + if (this.prop_3 is MutableList<*>) { + this.prop_3 + this.prop_3[0] + & T!! & T")!>prop_3 + & T!! & T")!>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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.fir.kt new file mode 100644 index 00000000000..9febe27e47f --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/51.fir.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 + } + ")!>y + ")!>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 + } + ")!>y + ")!>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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.kt new file mode 100644 index 00000000000..576ac39d1a3 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/52.fir.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 T?.case_10() = this +fun T?.case_10() = this +fun case_10() { + var x: Int? = 10 + x = null + x.case_10() +} + +// TESTCASE NUMBER: 11 +fun 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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.fir.kt new file mode 100644 index 00000000000..1ac51d10d58 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/53.fir.kt @@ -0,0 +1,104 @@ +// !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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.fir.kt new file mode 100644 index 00000000000..de1d30e62bf --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/54.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.fir.kt new file mode 100644 index 00000000000..3609ad85cc9 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/55.fir.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 + & kotlin.Any")!>x + } +} + +/* + * TESTCASE NUMBER: 4 + * ISSUES: KT-10662 + */ +fun case_4(x: Any?) { + if (x is Map.Entry<*, *>?) { + ")!>x!!.value + & kotlin.Any?")!>x + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.kt new file mode 100644 index 00000000000..a15c29853f7 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/56.fir.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) >>")!>x::fun_1 +} + +/* + * TESTCASE NUMBER: 2 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17386 + */ +fun case_2(x: Class?) { + val y = >>?")!>if (x != null) x::fun_1 else null + >>?")!>y +} + +/* + * TESTCASE NUMBER: 3 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-17386 + */ +fun case_3(x: Class?) { + val y = >>?")!>if (x != null) Class::fun_1 else null + >>?")!>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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.fir.kt new file mode 100644 index 00000000000..4694a2cd326 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/57.fir.kt @@ -0,0 +1,135 @@ +// !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 + * 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 + * 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 + * 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 + * 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 + * 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 + * 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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.fir.kt new file mode 100644 index 00000000000..e4c0268d5bf --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/58.fir.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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.kt new file mode 100644 index 00000000000..3f392e70443 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/59.fir.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) + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt new file mode 100644 index 00000000000..206d6459db2 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/6.fir.kt @@ -0,0 +1,1424 @@ +// !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 + * ISSUES: KT-35668 + */ +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) { + z.B19.C19.D19 + z.B19.C19.D19.equals(null) + z.B19.C19.D19.propT + z.B19.C19.D19.propAny + z.B19.C19.D19.propNullableT + z.B19.C19.D19.propNullableAny + z.B19.C19.D19.funT() + z.B19.C19.D19.funAny() + z.B19.C19.D19.funNullableT() + 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) { + 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?, z: Nothing?) { + if (a != z && b !== z && b !== z) { + val x = 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) { + a(?")!>b) + , kotlin.Unit>?")!>a.equals(null) + , kotlin.Unit>?")!>a.propT + , kotlin.Unit>?")!>a.propAny + , kotlin.Unit>?")!>a.propNullableT + , kotlin.Unit>?")!>a.propNullableAny + , kotlin.Unit>?")!>a.funT() + , kotlin.Unit>?")!>a.funAny() + , kotlin.Unit>?")!>a.funNullableT() + , kotlin.Unit>?")!>a.funNullableAny() + ?")!>b.equals(null) + ?")!>b.propT + ?")!>b.propAny + ?")!>b.propNullableT + ?")!>b.propNullableAny + ?")!>b.funT() + ?")!>b.funAny() + ?")!>b.funNullableT() + ?")!>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 = y() + + if (z1 != z && implicitNullableNothingProperty !== z1) { + z1.a + z1.equals(null) + z1.propT + z1.propAny + z1.propNullableT + z1.propNullableAny + z1.funT() + z1.funAny() + z1.funNullableT() + 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 = 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 = 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 = 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 + * UNEXPECTED BEHAVIOUR + */ +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 + * UNEXPECTED BEHAVIOUR + */ +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) { + 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 + * UNEXPECTED BEHAVIOUR + */ +fun case_57(a: (() -> Unit)) { + var z = null + + if (a == z) { + ")!>a + ")!>a.java + } +} + +/* + * TESTCASE NUMBER: 58 + * UNEXPECTED BEHAVIOUR + */ +fun case_58(a: ((Float) -> Int?)?, b: Float?, z: Nothing?) { + if (a === z && b == z || z == a && z === b) { + ?")!>a + b + if (a != z) { + ?")!>a + ?")!>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>?")!>a + ?")!>b + , kotlin.Unit>?")!>a.equals(null) + , kotlin.Unit>?")!>a.propT + , kotlin.Unit>?")!>a.propAny + , kotlin.Unit>?")!>a.propNullableT + , kotlin.Unit>?")!>a.propNullableAny + , kotlin.Unit>?")!>a.funT() + , kotlin.Unit>?")!>a.funAny() + , kotlin.Unit>?")!>a.funNullableT() + , kotlin.Unit>?")!>a.funNullableAny() + ?")!>b.equals(null) + ?")!>b.propT + ?")!>b.propAny + ?")!>b.propNullableT + ?")!>b.propNullableAny + ?")!>b.funT() + ?")!>b.funAny() + ?")!>b.funNullableT() + ?")!>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 = y() + + if (z == nullableNothingProperty) { + 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 + * ISSUES: KT-35668 + */ +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 + * ISSUES: KT-35668 + */ +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 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28362, KT-27032, KT-35668 + */ +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 + * UNEXPECTED BEHAVIOUR + * 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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.fir.kt new file mode 100644 index 00000000000..dd56d900198 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/60.fir.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 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.kt new file mode 100644 index 00000000000..0dcb9406bb2 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/61.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/62.fir.kt new file mode 100644 index 00000000000..d7b4737b9b5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/62.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.fir.kt new file mode 100644 index 00000000000..f94e0ce9d26 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/63.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.fir.kt new file mode 100644 index 00000000000..a0d40bdfaf1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/64.fir.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 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.kt new file mode 100644 index 00000000000..605f4f7ffc1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/65.fir.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() + & kotlin.Any?")!>x + & kotlin.Any?")!>x.first +} + +// TESTCASE NUMBER: 8 +fun case_8(x: Any?) { + if (x !is Pair<*, *>?) return + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x?.first +} + +// TESTCASE NUMBER: 9 +fun case_9(x: Any?) { + when (x) { + !is Pair<*, *> -> throw Exception() + else -> { + & kotlin.Any?")!>x + & kotlin.Any?")!>x.first + } + } + & kotlin.Any?")!>x + & kotlin.Any?")!>x.first +} + +// TESTCASE NUMBER: 10 +fun case_10(x: Any?) { + when (x) { + !is Pair<*, *>? -> return + else -> { + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x?.first + } + } + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x?.first +} + +// TESTCASE NUMBER: 11 +fun case_11(x: Any?) { + when { + x !is Pair<*, *> -> throw Exception() + else -> { + & kotlin.Any?")!>x + & kotlin.Any?")!>x.first + } + } + & kotlin.Any?")!>x + & kotlin.Any?")!>x.first +} + +// TESTCASE NUMBER: 12 +fun case_12(x: Any?) { + when { + x !is Pair<*, *>? -> return + else -> { + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x?.first + } + } + ? & kotlin.Any?")!>x + ? & kotlin.Any?")!>x?.first +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.kt new file mode 100644 index 00000000000..c2ff525296c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/66.fir.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? -> { + & kotlin.Pair<*, *>?")!>x + & kotlin.Pair<*, *>?")!>x.equals(10) + } + else -> return + } + & kotlin.Pair<*, *>?")!>x + & kotlin.Pair<*, *>?")!>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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.fir.kt new file mode 100644 index 00000000000..d971de66ba1 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/67.fir.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) +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.kt new file mode 100644 index 00000000000..39aaef1dfd5 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/68.fir.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 + } +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.kt new file mode 100644 index 00000000000..6b4b1c1d13c --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/69.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.kt new file mode 100644 index 00000000000..012f8c60a30 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/7.fir.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) { + a.B19.C19.D19 + a.B19.C19.D19.equals(null) + a.B19.C19.D19.propT + a.B19.C19.D19.propAny + a.B19.C19.D19.propNullableT + a.B19.C19.D19.propNullableAny + a.B19.C19.D19.funT() + a.B19.C19.D19.funAny() + a.B19.C19.D19.funNullableT() + 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) { + 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?, c: Nothing?) { + if (a != null && b !== null || a != c && b !== c) { + val x = 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) { + a(?")!>b) + , kotlin.Unit>?")!>a.equals(null) + , kotlin.Unit>?")!>a.propT + , kotlin.Unit>?")!>a.propAny + , kotlin.Unit>?")!>a.propNullableT + , kotlin.Unit>?")!>a.propNullableAny + , kotlin.Unit>?")!>a.funT() + , kotlin.Unit>?")!>a.funAny() + , kotlin.Unit>?")!>a.funNullableT() + , kotlin.Unit>?")!>a.funNullableAny() + ?")!>b.equals(null) + ?")!>b.propT + ?")!>b.propAny + ?")!>b.propNullableT + ?")!>b.propNullableAny + ?")!>b.funT() + ?")!>b.funAny() + ?")!>b.funNullableT() + ?")!>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 = y() + + if (z != null) { + z.a + z.equals(null) + z.propT + z.propAny + z.propNullableT + z.propNullableAny + z.funT() + z.funAny() + z.funNullableT() + 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 = 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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.fir.kt new file mode 100644 index 00000000000..aa655dc5f42 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/70.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.fir.kt new file mode 100644 index 00000000000..7a8ededb58e --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/71.fir.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 +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.kt new file mode 100644 index 00000000000..1a7048248be --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/72.fir.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 & kotlin.collections.MutableList")!>list + val s: String = & kotlin.collections.MutableList & kotlin.collections.MutableList")!>list[0] +} diff --git a/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.kt new file mode 100644 index 00000000000..bafb58bbc69 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/73.fir.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.fir.kt new file mode 100644 index 00000000000..42462a072b4 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/8.fir.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?")!>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: 2 +fun case_2(a: Inv?>?>?>?>?>?) { + if (a != null) { + val b = ?>?>?>?>?> & Inv?>?>?>?>?>?")!>a.get() + if (b != null) { + val c = ?>?>?>?> & Inv?>?>?>?>?")!>b.get() + if (c != null) { + val d = ?>?>?> & Inv?>?>?>?")!>c.get() + if (d != null) { + val e = ?>?> & Inv?>?>?")!>d.get() + if (e != null) { + val f = ?> & Inv?>?")!>e.get() + if (f != null) { + val g = & Inv?")!>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: Inv?, b: Inv = if (a != null) & Inv?")!>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?")!>nullableOut.equals(null) + & Out?")!>nullableOut.propT + & Out?")!>nullableOut.propAny + & Out?")!>nullableOut.propNullableT + & Out?")!>nullableOut.propNullableAny + & Out?")!>nullableOut.funT() + & Out?")!>nullableOut.funAny() + & Out?")!>nullableOut.funNullableT() + & Out?")!>nullableOut.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: 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: 8 +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.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.fir.kt b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.kt new file mode 100644 index 00000000000..29d9692c466 --- /dev/null +++ b/compiler/tests-spec/testData/diagnostics/notLinked/dfa/pos/9.fir.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?) { + 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?>?>?>?>?>?) { + if (a != null) { + val b = ?>?>?>?>?> & Out?>?>?>?>?>?")!>a.get() + if (b != null) { + val c = ?>?>?>?> & Out?>?>?>?>?")!>b.get() + if (c != null) { + val d = ?>?>?> & Out?>?>?>?")!>c.get() + if (d != null) { + val e = ?>?> & Out?>?>?")!>d.get() + if (e != null) { + val f = ?> & Out?>?")!>e.get() + if (f != null) { + val g = & Out?")!>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) + ")!>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?, b: Out = if (a != null) & Out?")!>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? = 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? = 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?")!>a.equals(null) + & kotlin.Any?")!>a.propT + & kotlin.Any?")!>a.propAny + & kotlin.Any?")!>a.propNullableT + & kotlin.Any?")!>a.propNullableAny + & kotlin.Any?")!>a.funT() + & kotlin.Any?")!>a.funAny() + & kotlin.Any?")!>a.funNullableT() + & kotlin.Any?")!>a.funNullableAny() + } + } +} + +// TESTCASE NUMBER: 16 +fun case_16(a: Any?) { + if (a === null) { + } else { + if (a !is ClassWithSixTypeParameters<*, *, *, *, *, *>?) { + } else { + & kotlin.Any?")!>a + & kotlin.Any?")!>a.equals(null) + & kotlin.Any?")!>a.propT + & kotlin.Any?")!>a.propAny + & kotlin.Any?")!>a.propNullableT + & kotlin.Any?")!>a.propNullableAny + & kotlin.Any?")!>a.funT() + & kotlin.Any?")!>a.funAny() + & kotlin.Any?")!>a.funNullableT() + & 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?>?>?>?>?")!>b.get() + if (c != null) { + val d = ?>?>?> & Out?>?>?>?")!>c.get() + if (d != null) { + val e = ?>?> & Out?>?>?")!>d.get() + if (e != null) { + val f = ?> & Out?>?")!>e.get() + if (f != null) { + val g = & Out?")!>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) { + 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) { + if (a.x != null) { + a.x + a.x.hashCode() + } +} + +/* + * TESTCASE NUMBER: 23 + * UNEXPECTED BEHAVIOUR + * ISSUES: KT-28785 + */ +fun case_23(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: 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(10) + + 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() + } +}