x is pat is a bool test: it can't bind variables, because they'd only exist when the
test succeeded. Use _ in the pattern, or a match/let ... else to get the values.
Wrong#
fn has(x: int?): bool = x is some(y)Fixed#
fn has(x: int?): bool = x is some(_)Common causes#
- Using
islike Rust'sif let: writematch x { some(y) => ..., none => ... }. - Struct field shorthand in an
ispattern: writeP { name: _, .. }.