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:
Clyybber 2020-05-02 16:09:02 +02:00 • committed by GitHub
commit 83547ec769
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 5 additions and 4 deletions

View file

@ -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)