Files
kotlin-fork/compiler/testData/diagnostics/tests/controlFlowAnalysis/assignedInTryWithoutCatch.fir.kt
T
Jinseong Jeon ed188204b4 FIR checker: make property init analyzer path-sensitive
In particular, exception throwing path after finally block is
distinguished via path label.

KT-42350 Fixed
2020-10-15 14:22:39 +03:00

40 lines
612 B
Kotlin
Vendored

fun assignedInTry() {
val a: Int
try {
a = 42
} finally {
}
a.hashCode()
}
fun sideEffectBeforeAssignmentInTry(s: Any) {
val a: Int
try {
s as String // Potential cast exception
a = 42
} finally {
}
a.hashCode()
}
fun assignedInTryAndFinally() {
val a: Int
try {
a = 42
} finally {
a = 41
}
a.hashCode()
}
fun sideEffectBeforeAssignmentInTryButNotFinally(s: Any) {
val a: Int
try {
s as String // Potential cast exception
a = 42
} finally {
a = 41
}
a.hashCode()
}