tobjconstr_outoforder.nim 597 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. discard """
  2. output: '''(left: 1, up: 0, right: 2, down: 0)
  3. (left: 0, up: 1, right: 0, down: 2)
  4. @[(left: 1, up: 0, right: 2, down: 0), (left: 0, up: 1, right: 0, down: 2)]
  5. @[(left: 1, up: 0, right: 2, down: 0), (left: 0, up: 1, right: 0, down: 2)]
  6. true'''
  7. """
  8. # bug #5339
  9. type
  10. Dirs = object
  11. left: int
  12. up: int
  13. right: int
  14. down: int
  15. let
  16. a = Dirs(
  17. left: 1,
  18. right: 2,
  19. )
  20. b = Dirs(
  21. up: 1,
  22. down: 2,
  23. )
  24. works = @[
  25. a,
  26. b,
  27. ]
  28. fails = @[
  29. Dirs(left: 1, right: 2),
  30. Dirs(up: 1, down: 2),
  31. ]
  32. echo a
  33. echo b
  34. echo works
  35. echo fails
  36. echo works == fails