What it means. A match expression has more than one default branch — either two case _ => clauses, or a mix of case _ => and an unguarded binding pattern (case n =>) that also catches everything.
package main
func name(n int) string = n match {
case 1 => "one"
case _ => "other"
case _ => "also-other" // second default
}
func main() {
Println(name(1))
}
error[GALA-E0006]: multiple default cases in match expression
--> e0006.gala:6:5
|
6 | case _ => "also-other"
| ^^^^ keep one default case
|
= hint: keep one default case; combine logic with guards or nested matches if you need sub-cases
The caret sits on the second default — the one that can never fire.
Keep exactly one default. If you need to distinguish several “other” groups, use a guard or move the branching into the default body:
func name(n int) string = n match {
case 1 => "one"
case n if n > 100 => "big"
case _ => "other"
}
The second default is unreachable. GALA emits the default as the final else of the generated if-else chain, so anything after it is dead code. Making it a compile error means you notice the duplication instead of wondering why a branch never fires.