summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2017-02-09 01:16:43 +0100
committerAndreas Rumpf <rumpf_a@web.de>2017-02-09 01:16:43 +0100
commit5ff6ff28bf9abf12fa9d82f0323954516a855b6a (patch)
tree238fb2421b28862490f92dbfaafa7fdc2860caa6 /tests
parent24a0927644d03f9e4247937ea92210dbd727a320 (diff)
downloadNim-5ff6ff28bf9abf12fa9d82f0323954516a855b6a.tar.gz
fixes #5339
Diffstat (limited to 'tests')
-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