diff options
author | Neelesh Chandola <neelesh.chandola@outlook.com> | 2018-12-13 13:59:46 +0530 |
---|---|---|
committer | Neelesh Chandola <neelesh.chandola@outlook.com> | 2018-12-13 13:59:46 +0530 |
commit | b2411db54119ea00296d12a47bd12a371bc0a4ba (patch) | |
tree | 79d537e3066eb5c9778df62faa3a53445a190892 /compiler/semstmts.nim | |
parent | abcf4d8b5dd4988c952a232d4a610d0491ff79ff (diff) | |
parent | a3c4791e9cde49f44e7261044cc84fa863bc717c (diff) | |
download | Nim-b2411db54119ea00296d12a47bd12a371bc0a4ba.tar.gz |
Merge remote-tracking branch 'upstream/devel' into record-case
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index d81410891..65df29913 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -800,11 +800,13 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode = typ = commonType(typ, x.sons[1]) closeScope(c) of nkElse: - chckCovered = false checkSonsLen(x, 1, c.config) x.sons[0] = semExprBranchScope(c, x.sons[0]) typ = commonType(typ, x.sons[0]) hasElse = true + if chckCovered and covered == toCover(c, n.sons[0].typ): + localError(c.config, x.info, "invalid else, all cases are already covered") + chckCovered = false else: illFormedAst(x, c.config) if chckCovered: |