tconstobjvariant.nim 243 B

123456789101112131415161718
  1. # This is a sample code, the first echo statement prints out the error
  2. type
  3. A = object
  4. case w: uint8
  5. of 1:
  6. n: int
  7. else:
  8. other: string
  9. const
  10. a = A(w: 1, n: 5)
  11. proc foo =
  12. let c = [a]
  13. doAssert c[0].n == 5
  14. foo()