Files
Nikolay Lunyak 7541732752 [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.
2023-06-19 07:40:15 +00:00

123 lines
3.0 KiB
Kotlin
Vendored

// !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) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.inv()
}
}
/*
* TESTCASE NUMBER: 2
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-29936
*/
fun case_2(x: Int?) {
operator fun Nothing?.not() = null
if (x != !null != false) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.inv()
}
}
/*
* TESTCASE NUMBER: 3
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-29936
*/
fun case_3(x: Int?) {
if (x == funWithoutArgs() == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Int")!>x<!>.inv()
}
}
/*
* TESTCASE NUMBER: 4
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-29936
*/
fun case_4(x: Int?, y: List<Nothing?>) {
if (x == y[0] == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>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) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>inv()
}
}
/*
* TESTCASE NUMBER: 6
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-28265
*/
fun case_6(x: Int?) {
val y = null
if (x == y == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>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) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int? & kotlin.Nothing?")!>x<!><!UNSAFE_CALL!>.<!>inv()
}
}
/*
* TESTCASE NUMBER: 8
* UNEXPECTED BEHAVIOUR
* ISSUES: KT-28265
*/
fun case_8(x: KClass<EmptyObject>?) {
if (x == EmptyObject::class == true) {
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KClass<EmptyObject>? & kotlin.reflect.KClass<EmptyObject>")!>x<!>
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.reflect.KClass<EmptyObject>? & kotlin.reflect.KClass<EmptyObject>")!>x<!>.java
}
}