summary refs log tree commit diff stats
path: root/tests
diff options
context:
space:
mode:
authorZahary Karadjov <zahary@gmail.com>2017-06-19 22:45:15 +0300
committerAndreas Rumpf <rumpf_a@web.de>2017-06-20 11:29:42 +0200
commit21ce7b2af4163b2513f3c6cbf2f52929d684bcb3 (patch)
tree28a5548f01a988dc09dcaf2af93313495d27b723 /tests
parenta6006e56a7eef8e4d678c8369cee6ba66094dd67 (diff)
downloadNim-21ce7b2af4163b2513f3c6cbf2f52929d684bcb3.tar.gz
Fix #5888
Diffstat (limited to 'tests')
-rw-r--r--tests/concepts/t5888.nim26
-rw-r--r--tests/concepts/t5888lib/ca.nim4
-rw-r--r--tests/concepts/t5888lib/opt.nim6
3 files changed, 36 insertions, 0 deletions
diff --git a/tests/concepts/t5888.nim b/tests/concepts/t5888.nim
new file mode 100644
index 000000000..dbbab8c4c
--- /dev/null
+++ b/tests/concepts/t5888.nim
@@ -0,0 +1,26 @@
+discard """
+output: '''
+true
+true
+true
+f
+0
+'''
+"""
+
+import t5888lib/ca, t5888lib/opt
+
+type LocalCA = ca.CA
+
+proc f(c: CA) =
+  echo "f"
+  echo c.x
+
+var o = new(Opt)
+
+echo o is CA
+echo o is LocalCA
+echo o is ca.CA
+
+o.f()
+
diff --git a/tests/concepts/t5888lib/ca.nim b/tests/concepts/t5888lib/ca.nim
new file mode 100644
index 000000000..4a811f797
--- /dev/null
+++ b/tests/concepts/t5888lib/ca.nim
@@ -0,0 +1,4 @@
+type
+  CA* = concept c
+    c.x is int
+
diff --git a/tests/concepts/t5888lib/opt.nim b/tests/concepts/t5888lib/opt.nim
new file mode 100644
index 000000000..65d16addc
--- /dev/null
+++ b/tests/concepts/t5888lib/opt.nim
@@ -0,0 +1,6 @@
+import ca
+
+type
+  Opt* = object
+    x*: int
+