trt_discrim_err0.nim 407 B

123456789101112131415161718
  1. discard """
  2. errormsg: "possible values {k1, k3, k4} are in conflict with discriminator values for selected object branch 3"
  3. line: 17
  4. """
  5. type
  6. Kind = enum k1, k2, k3, k4, k5
  7. KindObj = object
  8. case kind: Kind
  9. of k1, k2..k3: i32: int32
  10. of k4: f32: float32
  11. else: str: string
  12. let kind = k3
  13. case kind
  14. of k2: discard KindObj(kind: kind, i32: 1)
  15. else: discard KindObj(kind: kind, str: "3")