summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorLemonBoy <thatlemon@gmail.com>2018-06-11 23:19:00 +0200
committerzah <zahary@gmail.com>2018-06-12 00:36:43 +0300
commitac0f9860081ce20cd1ce1f823db7361ad284b1be (patch)
tree74d13240aec94ae8da5e386d46449cafa2dc65c3 /tests
parent1074cc1fb9bd0a69f1990f936dd82313cfb2c2c8 (diff)
downloadNim-ac0f9860081ce20cd1ce1f823db7361ad284b1be.tar.gz
Correct field lookup in concept types
Fixes #6770
Diffstat (limited to 'tests')
-rw-r--r--tests/concepts/t6770.nim27
1 files changed, 27 insertions, 0 deletions
diff --git a/tests/concepts/t6770.nim b/tests/concepts/t6770.nim
new file mode 100644
index 000000000..1787ee670
--- /dev/null
+++ b/tests/concepts/t6770.nim
@@ -0,0 +1,27 @@
+discard """
+output: '''
+10
+10
+'''
+"""
+
+type GA = concept c
+  c.a is int
+
+type A = object
+  a: int
+
+type AA = object
+  case exists: bool
+  of true:
+    a: int
+  else:
+    discard
+
+proc print(inp: GA) =
+  echo inp.a
+
+let failing = AA(exists: true, a: 10)
+let working = A(a:10)
+print(working)
+print(failing)