Files
kotlin-fork/compiler/testData/diagnostics/tests/safeCalls/safeCallWithSmartCast.fir.kt
T
Anastasia.Nekrasova aef6787e87 [Test] Add a test covering changes in the evaluation semantics of safe call with smart cast in K2
Addition to other safe call tests that are already present in tests.

^KT-41034
2023-08-24 11:38:13 +00:00

16 lines
233 B
Kotlin
Vendored
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
// WITH_STDLIB
class C {
var x: Int = 0
}
fun test(с: C?, a: Any) {
с?.x = if (a is String) 0 else throw Exception();
a.<!UNRESOLVED_REFERENCE!>toUpperCase<!>()
}
fun main(args: Array<String>) {
test(null, 1)
}