You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Sum type with generic doesn't believe its exhaustive and also does at same timeย #27515
Sum type with generic doesn't believe its exhaustive and also does at same time. IT does work without the T block and only the else block.
Reproduction Steps
You can reproduce both errors by commenting/uncommenting the else block to switch between the two errors
structSomething {}
type Any[T] =string|int| T
fnsomething[T](my_var Any[T]) int {
match my_var {
string {
return1
}
int {
return0
}
// If T is here without else it says monolith.v:6:2: error: match must be exhaustive (add `else {}` at the end)
T {
return3
}
// IF T and else are here it says monolith.v:17:3: error: match expression is exhaustive, `else` is unnecessaryelse {
return4
}
}
return1
}
fnmain() {
new_var:=5println(something(Something{}))
}
Expected Behavior
Expect it to Complie with the T block, and no else block
Current Behavior
doesnt complie with T block or T block and else block
Activity