Files
kotlin-fork/compiler/testData/diagnostics/tests/controlStructures/kt30406.kt
T
Ilya Kirillov 1bbcae5ed2 [FIR] fix resolve contract violation from scopes
We cannot call lazy resolve to STATUS phase from scopes as scopes may be accessed on a STATUS phase or earlier

^KT-54890
^KTIJ-23587 fixed
2023-01-13 21:32:51 +00:00

15 lines
468 B
Kotlin
Vendored

// !DIAGNOSTICS: -UNUSED_EXPRESSION
// !CHECK_TYPE
// Issue: KT-30406
interface Option<out T> {
val s: String
}
class Some<T>(override val s: String) : Option<T>
class None(override val s: String = "None") : Option<Int>
fun test(a: Int): Option<Any> =
<!DEBUG_INFO_EXPRESSION_TYPE("Option<kotlin.Any>")!>if (a == 239)
<!DEBUG_INFO_EXPRESSION_TYPE("Some<kotlin.Any>")!>Some("239")<!>
else
<!DEBUG_INFO_EXPRESSION_TYPE("None")!>None()<!><!>