summary refs log tree commit diff stats
path: root/tests/ccgbugs/tobjconstr_outoforder.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/ccgbugs/tobjconstr_outoforder.nim')
-rw-r--r--tests/ccgbugs/tobjconstr_outoforder.nim38
1 files changed, 38 insertions, 0 deletions
diff --git a/tests/ccgbugs/tobjconstr_outoforder.nim b/tests/ccgbugs/tobjconstr_outoforder.nim
new file mode 100644
index 000000000..846a753d5
--- /dev/null
+++ b/tests/ccgbugs/tobjconstr_outoforder.nim
@@ -0,0 +1,38 @@
+discard """
+  output: '''(left: 1, up: 0, right: 2, down: 0)
+(left: 0, up: 1, right: 0, down: 2)
+@[(left: 1, up: 0, right: 2, down: 0), (left: 0, up: 1, right: 0, down: 2)]
+@[(left: 1, up: 0, right: 2, down: 0), (left: 0, up: 1, right: 0, down: 2)]
+true'''
+"""
+
+# bug #5339
+type
+  Dirs = object
+    left: int
+    up: int
+    right: int
+    down: int
+
+let
+  a = Dirs(
+    left: 1,
+    right: 2,
+  )
+  b = Dirs(
+    up: 1,
+    down: 2,
+  )
+  works = @[
+    a,
+    b,
+  ]
+  fails = @[
+    Dirs(left: 1, right: 2),
+    Dirs(up: 1, down: 2),
+  ]
+echo a
+echo b
+echo works
+echo fails
+echo works == fails