[FIR] Fix TEST SPEC tests

Ensure the test data contents for both the frontends
are identical. This is needed for proper analysis of
K2-differences.
This commit is contained in:
Nikolay Lunyak
2023-06-12 15:20:46 +03:00
committed by Space Team
parent e6633d3d92
commit 7541732752
583 changed files with 4053 additions and 5418 deletions
@@ -1,7 +1,16 @@
// !DIAGNOSTICS: -UNUSED_EXPRESSION -UNUSED_VARIABLE -UNREACHABLE_CODE -CAN_BE_VAL
// !DIAGNOSTICS: -UNUSED_EXPRESSION
// SKIP_TXT
// WITH_EXTENDED_CHECKERS
/*
* 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
@@ -235,7 +244,7 @@ fun case_12(x: TypealiasNullableString, y: TypealiasNullableString, z1: Nothing?
// TESTCASE NUMBER: 13
fun case_13(x: EmptyClass12_48?, z: Nothing?) =
if (x == z || <!SENSELESS_COMPARISON!>x === z<!> && <!SENSELESS_COMPARISON!>x == z<!>) {
if (x == z || <!SENSELESS_COMPARISON!>x === z<!> && <!SENSELESS_COMPARISON!>x <!UNREACHABLE_CODE!>== z<!><!>) {
throw Exception()
} else {
<!DEBUG_INFO_EXPRESSION_TYPE("othertypes.EmptyClass12_48? & othertypes.EmptyClass12_48")!>x<!>
@@ -280,7 +289,7 @@ fun case_14() {
// TESTCASE NUMBER: 15
fun case_15(x: TypealiasNullableString) {
val y = null
val z = if (x === null || <!SENSELESS_COMPARISON!>y == x<!> && <!SENSELESS_COMPARISON!>x === y<!> || <!SENSELESS_COMPARISON!>null === x<!>) "" else {
val <!UNUSED_VARIABLE!>z<!> = if (x === null || <!SENSELESS_COMPARISON!>y == x<!> && <!SENSELESS_COMPARISON!>x <!UNREACHABLE_CODE!>=== y<!><!> || <!SENSELESS_COMPARISON!>null === x<!>) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.String")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.String")!>x<!>.equals(null)
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString & kotlin.String")!>x<!>.propT
@@ -301,7 +310,7 @@ fun case_16() {
if (<!SENSELESS_COMPARISON!>x !== y<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing & kotlin.Nothing")!>x<!>.hashCode()
<!UNREACHABLE_CODE!><!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing & kotlin.Nothing")!>x<!>.hashCode()<!>
}
}
@@ -507,7 +516,7 @@ fun case_25(b: Boolean, z: Nothing?) {
// TESTCASE NUMBER: 26
fun case_26(a: ((Float) -> Int?)?, b: Float?) {
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (a != z == true && b != implicitNullableNothingProperty == true) {
val x = <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int?")!>a(<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Float? & kotlin.Float")!>b<!>)<!>
@@ -645,7 +654,7 @@ fun case_32(a: DeepObject.A.B.C.D.E.F.G.J?) =
// TESTCASE NUMBER: 33
fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) {
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (true && a == z == true || b == null == true) {
@@ -674,9 +683,9 @@ fun case_33(a: ((Float) -> Int?)?, b: Float?, c: Boolean?) {
* ISSUES: KT-28329
*/
fun case_34(z1: Boolean?) {
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && <!FORBIDDEN_IDENTITY_EQUALS_WARNING, SENSELESS_COMPARISON!>EnumClassWithNullableProperty.A.prop_1 !== null<!> && <!FORBIDDEN_IDENTITY_EQUALS_WARNING, SENSELESS_COMPARISON!>EnumClassWithNullableProperty.A.prop_1 !== z<!> || z1 != implicitNullableNothingProperty || z1!! && true && true) {
if (true && true && true && true && EnumClassWithNullableProperty.A.prop_1 != implicitNullableNothingProperty && <!FORBIDDEN_IDENTITY_EQUALS_WARNING, SENSELESS_COMPARISON!>EnumClassWithNullableProperty.A.prop_1 !== null<!> && <!FORBIDDEN_IDENTITY_EQUALS_WARNING, SENSELESS_COMPARISON!>EnumClassWithNullableProperty.A.prop_1 !== z<!> || z1 != implicitNullableNothingProperty || z1!! && <!UNREACHABLE_CODE!>true<!> && <!UNREACHABLE_CODE!>true<!>) {
} else {
EnumClassWithNullableProperty.A.prop_1
@@ -709,11 +718,11 @@ fun case_35(a: DeepObject.A.B.C.D.E.F.G.J?) {
* UNEXPECTED BEHAVIOUR
*/
fun case_36(x: Any) {
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (<!SENSELESS_COMPARISON!>x == z<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>java<!>
<!UNREACHABLE_CODE!><!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any & kotlin.Nothing")!>x<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>java<!><!>
}
}
@@ -735,7 +744,7 @@ fun case_38() {
<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>if (<!SENSELESS_COMPARISON!>Object.prop_2 != z<!>)
else {
Object.prop_2
Object.prop_2.java
<!UNREACHABLE_CODE!>Object.prop_2.java<!>
}<!>
}
@@ -750,7 +759,7 @@ fun case_39(x: Char?) {
// TESTCASE NUMBER: 40
fun case_40() {
val x: Unit? = null
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (x == implicitNullableNothingProperty || <!SENSELESS_COMPARISON!>z === x<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Unit?")!>x<!>
@@ -819,7 +828,7 @@ fun case_44(x: TypealiasNullableString<!REDUNDANT_NULLABLE!>?<!>, z1: Nothing?)
// TESTCASE NUMBER: 45
fun case_45() {
val a = Class()
var z: Nothing? = null
<!CAN_BE_VAL!>var<!> z: Nothing? = null
if (a.prop_4 != z || true) {
if (a.prop_4 == null) {
@@ -832,7 +841,7 @@ fun case_45() {
// TESTCASE NUMBER: 46
fun case_46(x: TypealiasNullableString<!REDUNDANT_NULLABLE!>?<!>, y: TypealiasNullableString) {
val t: TypealiasNullableString = null
var z: Nothing? = null
<!CAN_BE_VAL!>var<!> z: Nothing? = null
if (x != nullableNothingProperty) {
@@ -886,7 +895,7 @@ class Case49 {
fun case_49() {
val a = Case49()
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (a.x === z) {
a.x
@@ -898,7 +907,7 @@ fun case_49() {
fun case_50(x: TypealiasNullableString) {
val z1 = null
val z2 = null
val t = if (x != z1 && <!SENSELESS_COMPARISON!>z2 !== x<!>) "" else {
val <!UNUSED_VARIABLE!>t<!> = if (x != z1 && <!SENSELESS_COMPARISON!>z2 !== x<!>) "" else {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableString")!>x<!>.hashCode()
}
@@ -909,7 +918,7 @@ fun case_51() {
val x: TypealiasNullableNothing = null
val z: Nothing? = null
if (<!SENSELESS_COMPARISON!>x === z<!> || <!SENSELESS_COMPARISON!>z == x<!> && <!SENSELESS_COMPARISON!>x == z<!> || false || false || false) {
if (<!SENSELESS_COMPARISON!>x === z<!> || <!SENSELESS_COMPARISON!>z <!UNREACHABLE_CODE!>==<!> x<!> && <!SENSELESS_COMPARISON, UNREACHABLE_CODE!>x == z<!> || false || false || false) {
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("TypealiasNullableNothing")!>x<!>.hashCode()
}
@@ -989,11 +998,11 @@ fun case_56() {
* UNEXPECTED BEHAVIOUR
*/
fun case_57(a: (() -> Unit)) {
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (<!SENSELESS_COMPARISON!>a == z<!>) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit> & kotlin.Nothing")!>a<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit> & kotlin.Nothing")!>a<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>java<!>
<!UNREACHABLE_CODE!><!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Function0<kotlin.Unit> & kotlin.Nothing")!>a<!>.<!NEW_INFERENCE_NO_INFORMATION_FOR_PARAMETER!>java<!><!>
}
}
@@ -1081,7 +1090,7 @@ fun case_61(x: Any?) {
// TESTCASE NUMBER: 62
fun case_62(x: Any?) {
var z = null
<!CAN_BE_VAL!>var<!> z = null
if (x is Number? && x is Int? && x != z) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Int")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & kotlin.Int")!>x<!>.equals(null)
@@ -1195,7 +1204,7 @@ fun case_66(x: Any?, z1: Nothing?, z2: Nothing?, b: Boolean) {
// TESTCASE NUMBER: 67
fun case_67(x: Any?) {
var z = null
<!CAN_BE_VAL!>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?) {
@@ -1289,7 +1298,7 @@ fun case_70(x: Any?) {
*/
fun case_71(t: Any?) {
val z1 = null
var z2 = z1
<!CAN_BE_VAL!>var<!> z2 = z1
if (t is Interface1?) {
if (t is Interface2?) {
@@ -1313,9 +1322,9 @@ fun case_71(t: Any?) {
* ISSUES: KT-28362, KT-27032, KT-35668
*/
fun case_72(t: Any?, z1: Nothing?) {
var z2 = null
<!CAN_BE_VAL!>var<!> z2 = null
if (t is Interface1? && t != z1 ?: z2 && t is Interface2?) {
if (t is Interface1? && t != z1 <!UNREACHABLE_CODE!>?:<!> z2 && t is Interface2?) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Interface1? & Interface2?")!>t<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Interface1? & Interface2?")!>t<!><!UNSAFE_CALL!>.<!>itest1()
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Any? & Interface1? & Interface2?")!>t<!><!UNSAFE_CALL!>.<!>itest2()