mirror of
https://github.com/nim-lang/Nim.git
synced 2025-12-30 09:54:49 +00:00
31 lines
389 B
Nim
31 lines
389 B
Nim
discard """
|
|
file: "tcaseexpr1.nim"
|
|
|
|
line: 29
|
|
errormsg: "type mismatch: got (string) but expected 'int'"
|
|
|
|
line: 23
|
|
errormsg: "not all cases are covered"
|
|
"""
|
|
|
|
type
|
|
E = enum A, B, C
|
|
|
|
proc foo(x: int): auto =
|
|
return case x
|
|
of 1..9: "digit"
|
|
else: "number"
|
|
|
|
var r = foo(10)
|
|
|
|
var x = C
|
|
|
|
var t1 = case x:
|
|
of A: "a"
|
|
of B: "b"
|
|
|
|
var t2 = case x:
|
|
of A: 10
|
|
of B, C: "23"
|
|
|