Files
kotlin-fork/compiler/tests-spec/testData/diagnostics/notLinked/dfa/neg/40.fir.kt
T
2020-04-21 09:52:52 +03:00

33 lines
736 B
Kotlin
Vendored

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