7541732752
Ensure the test data contents for both the frontends are identical. This is needed for proper analysis of K2-differences.
56 lines
1.3 KiB
Kotlin
Vendored
56 lines
1.3 KiB
Kotlin
Vendored
// !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 { <!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Int & kotlin.Int?"), DEBUG_INFO_SMARTCAST!>x<!> += 10; }
|
|
}
|
|
|
|
// TESTCASE NUMBER: 2
|
|
fun case_2() {
|
|
var x: Boolean? = true
|
|
if (x != null) {
|
|
try {
|
|
throw Exception()
|
|
} catch (e: Exception) {
|
|
x = null
|
|
}
|
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean & kotlin.Boolean?"), DEBUG_INFO_SMARTCAST!>x<!>.not()
|
|
}
|
|
}
|
|
|
|
// TESTCASE NUMBER: 3
|
|
fun case_3() {
|
|
var x: Boolean? = true
|
|
if (x is Boolean) {
|
|
try {
|
|
throw Exception()
|
|
} catch (e: Exception) {
|
|
x = null
|
|
}
|
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean & kotlin.Boolean?"), DEBUG_INFO_SMARTCAST!>x<!>.not()
|
|
}
|
|
}
|
|
|
|
// TESTCASE NUMBER: 4
|
|
fun case_4() {
|
|
var x: Boolean? = true
|
|
x as Boolean
|
|
try {
|
|
x = null
|
|
} finally { }
|
|
<!DEBUG_INFO_EXPRESSION_TYPE("kotlin.Boolean & kotlin.Boolean?"), DEBUG_INFO_SMARTCAST!>x<!>.not()
|
|
} |