how come smart casting doesn't work here? i get `...
# announcements
m
how come smart casting doesn't work here? i get
unresolved reference: value
for the
is Match.HasMatch
line
Copy code
sealed class Match {
    object NoMatch : Match()
    class HasMatch(value: Int) : Match()
}

fun main() {
    val x: Match? = null

    when (x) {
        Match.NoMatch -> println("no match")
        is Match.HasMatch -> println("value: ${x.value}")
        null -> println("null")
    }
}
n
missing
val
in your
HasMatch
constructor
m
oh goddammit i'm an idiot. thank you for pointing that out
n
np