V version: V 0.1.26 abd0686.abd0686
OS: MacOS
What did you do?
// enums.v
enum Colour { red green blue }
fn main() {
mut col := Colour.red
match col {
.red { println("Red") }
.green { println("Green") }
.blue { println("Blue") }
}
}
% v enums.v
What did you expect to see?
Red
What did you see instead?
enums.v:9:0: error: match must be exhaustive
@planmac You need to add an empty else condition inside the match statement for it to work.
Well that's the thing. If all vals are checked, else should not be needed.
Thats what I would have expected - if all the vals are included then 'else' should not be needed, otherwise the compile check for exhaustive is of no use whatsoever!
Should this part of checking moved to checker.v? @medvednikov
Why did you close this @danieldaeschle ?
It's not fixed yet.
Most helpful comment
Well that's the thing. If all vals are checked, else should not be needed.