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
23
tests/casestmt/tincompletecaseobject2.nim
Normal file
23
tests/casestmt/tincompletecaseobject2.nim
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
discard """
|
||||
cmd: "nim check $file"
|
||||
errormsg: "not all cases are covered; missing: {A, B}"
|
||||
nimout: '''
|
||||
tincompletecaseobject2.nim(16, 1) Error: not all cases are covered; missing: {B, C, D}
|
||||
tincompletecaseobject2.nim(19, 1) Error: not all cases are covered; missing: {A, C}
|
||||
tincompletecaseobject2.nim(22, 1) Error: not all cases are covered; missing: {A, B}
|
||||
'''
|
||||
"""
|
||||
type
|
||||
ABCD = enum A, B, C, D
|
||||
AliasABCD = ABCD
|
||||
RangeABC = range[A .. C]
|
||||
AliasRangeABC = RangeABC
|
||||
|
||||
case AliasABCD A:
|
||||
of A: discard
|
||||
|
||||
case RangeABC A:
|
||||
of B: discard
|
||||
|
||||
case AliasRangeABC A:
|
||||
of C: discard
|
||||
Loading…
Add table
Add a link
Reference in a new issue