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
|
|
@ -695,7 +695,7 @@ proc semRecordCase(c: PContext, n: PNode, check: var IntSet, pos: var int,
|
|||
of nkElse:
|
||||
checkSonsLen(b, 1, c.config)
|
||||
if chckCovered and covered == toCover(c, a[0].typ):
|
||||
localError(c.config, b.info, "invalid else, all cases are already covered")
|
||||
message(c.config, b.info, warnUnreachableElse)
|
||||
chckCovered = false
|
||||
else: illFormedAst(n, c.config)
|
||||
delSon(b, b.len - 1)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue