tcaseobj.nim 321 B

1234567891011121314151617181920
  1. # issue #17571
  2. import std/[macros, objectdollar]
  3. type
  4. MyEnum = enum
  5. F, S, T
  6. Foo = object
  7. case o: MyEnum
  8. of F:
  9. f: string
  10. of S:
  11. s: string
  12. of T:
  13. t: string
  14. let val = static(Foo(o: F, f: "foo")).f
  15. doAssert val == "foo"
  16. doAssert $static(Foo(o: F, f: "foo")) == $Foo(o: F, f: "foo")