Skip to content

Misleading error for case statement when range expression in of-branch is invalid #1511

Open
@alaviss

Description

@alaviss

Example

type
  E {.pure.} = enum A, B, C, D
  A = int

var e: E
case e
of A..C: discard
of D: discard

Actual Output

test.nim(6, 1) Error: not all cases are covered; missing: {A, B, C}

Expected Output

test.nim(7, 4) Error: type mismatch: got 'typedesc[A]' for 'A' but expected 'E = enum'

Possible Solution

  • This is likely just an error propagation issue for infix, because the real error can be found if --errorMax:0 is used.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcompiler/msgsCompiler output and diagnostic subsystem: error and warnig reporting, information, debugginggood first issueEasy-to-start-with issue with no in-depth knowledge or complex implementation required.

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions