Make unreachable else in case statements a warning instead of an error (#14190)
* Fix #14019 by making trailing else a warning * Rename to UnreachableElse
This commit is contained in:
parent
1f1e4de3bc
commit
83547ec769
3 changed files with 5 additions and 4 deletions
|
|
@ -998,7 +998,7 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode =
|
|||
x[0] = semExprBranchScope(c, x[0])
|
||||
typ = commonType(typ, x[0])
|
||||
if (chckCovered and covered == toCover(c, n[0].typ)) or hasElse:
|
||||
localError(c.config, x.info, "invalid else, all cases are already covered")
|
||||
message(c.config, x.info, warnUnreachableElse)
|
||||
hasElse = true
|
||||
chckCovered = false
|
||||
else:
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue