trt_discrim_err1.nim 524 B

123456789101112131415161718
  1. discard """
  2. errormsg: "branch initialization with a runtime discriminator is not supported inside of an `elif` branch."
  3. line: 16
  4. """
  5. type
  6. Color = enum Red, Green, Blue
  7. ColorObj = object
  8. case colorKind: Color
  9. of Red: red: string
  10. of Green: green: string
  11. of Blue: blue: string
  12. let colorKind = Blue
  13. case colorKind
  14. of Red: echo ColorObj(colorKind: colorKind, red: "red")
  15. elif colorKind == Green: echo ColorObj(colorKind: colorKind, green: "green")
  16. else: echo ColorObj(colorKind: colorKind, blue: "blue")