Skip to content

Commit

Permalink
fix #13255
Browse files Browse the repository at this point in the history
  • Loading branch information
krux02 committed Feb 5, 2020
1 parent 574f613 commit 06717c4
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions compiler/semstmts.nim
Original file line number Diff line number Diff line change
Expand Up @@ -945,9 +945,9 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode =
checkSonsLen(x, 1, c.config)
x[0] = semExprBranchScope(c, x[0])
typ = commonType(typ, x[0])
hasElse = true
if chckCovered and covered == toCover(c, n[0].typ):
if (chckCovered and covered == toCover(c, n[0].typ)) or hasElse:
localError(c.config, x.info, "invalid else, all cases are already covered")
hasElse = true
chckCovered = false
else:
illFormedAst(x, c.config)
Expand Down

0 comments on commit 06717c4

Please sign in to comment.