tcaseexpr1.nim 488 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. discard """
  2. cmd: "nim check $options $file"
  3. action: "reject"
  4. nimout: '''
  5. tcaseexpr1.nim(33, 10) Error: not all cases are covered; missing: {C}
  6. tcaseexpr1.nim(39, 12) Error: type mismatch: got <string> but expected 'int literal(10)'
  7. '''
  8. """
  9. # line 20
  10. type
  11. E = enum A, B, C
  12. proc foo(x: int): auto =
  13. return case x
  14. of 1..9: "digit"
  15. else: "number"
  16. var r = foo(10)
  17. var x = C
  18. var t1 = case x:
  19. of A: "a"
  20. of B: "b"
  21. var t2 = case x:
  22. of A: 10
  23. of B, C: "23"