Merge remote-tracking branch 'upstream/devel' into record-case

This commit is contained in:
Neelesh Chandola 2018-12-13 13:59:46 +05:30
commit b2411db541
7 changed files with 27 additions and 18 deletions

View file

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