Better case coverage error message for alias and range enum (#12913)
This commit is contained in:
parent
148f6d9820
commit
3c38edf563
6 changed files with 100 additions and 70 deletions
|
|
@ -953,9 +953,9 @@ proc semCase(c: PContext, n: PNode; flags: TExprFlags): PNode =
|
|||
if chckCovered:
|
||||
if covered == toCover(c, n[0].typ):
|
||||
hasElse = true
|
||||
elif n[0].typ.kind == tyEnum:
|
||||
localError(c.config, n.info, "not all cases are covered; missing: {$1}" %
|
||||
formatMissingEnums(n))
|
||||
elif n[0].typ.skipTypes(abstractRange).kind == tyEnum:
|
||||
localError(c.config, n.info, "not all cases are covered; missing: $1" %
|
||||
formatMissingEnums(c, n))
|
||||
else:
|
||||
localError(c.config, n.info, "not all cases are covered")
|
||||
popCaseContext(c)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue