mfield_defect.nim 366 B

12345678910111213141516171819202122232425262728293031
  1. #[
  2. ran from trunner
  3. ]#
  4. # line 10
  5. type Kind = enum k0, k1, k2, k3, k4
  6. type Foo = object
  7. case kind: Kind
  8. of k0: f0: int
  9. of k1: f1: int
  10. of k2: f2: int
  11. of k3: f3: int
  12. of k4: f4: int
  13. proc main()=
  14. var foo = Foo(kind: k3, f3: 3)
  15. let s1 = foo.f3
  16. doAssert s1 == 3
  17. let s2 = foo.f2
  18. when defined case1:
  19. static: main()
  20. when defined case2:
  21. main()