sm
This commit is contained in:
@@ -1,23 +0,0 @@
|
||||
// Issue: match on u8 value with enum result assigned to typed field
|
||||
// The switch value is u8 but case constants are s64 (default int literal type).
|
||||
// Compiler should cast case constants to match the switch value type.
|
||||
// LLVM error: Switch constants must all be same type as switch value!
|
||||
|
||||
out :: (str: string) -> void #builtin;
|
||||
|
||||
Button :: enum {
|
||||
none;
|
||||
left;
|
||||
middle;
|
||||
right;
|
||||
}
|
||||
|
||||
main :: () {
|
||||
val : u8 = 2;
|
||||
result : Button = if val == {
|
||||
case 1: .left;
|
||||
case 2: .middle;
|
||||
case 3: .right;
|
||||
else: .none;
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user