sm
This commit is contained in:
@@ -1,25 +0,0 @@
|
||||
// Issue: enum literal inference in match expression used as assignment RHS
|
||||
// When a match expression is assigned to a field with a known enum type,
|
||||
// the enum literals in case arms should infer their type from the assignment target.
|
||||
|
||||
Color :: enum {
|
||||
red;
|
||||
green;
|
||||
blue;
|
||||
none;
|
||||
}
|
||||
|
||||
Thing :: struct {
|
||||
color: Color;
|
||||
}
|
||||
|
||||
main :: () {
|
||||
t : Thing = ---;
|
||||
value : u8 = 1;
|
||||
t.color = if value == {
|
||||
case 1: .red; // error: cannot infer enum type for literal
|
||||
case 2: .green;
|
||||
case 3: .blue;
|
||||
else: .none;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user