summary refs log tree commit diff stats
path: root/tests/concepts/twrapconcept.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/concepts/twrapconcept.nim')
-rw-r--r--tests/concepts/twrapconcept.nim21
1 files changed, 21 insertions, 0 deletions
diff --git a/tests/concepts/twrapconcept.nim b/tests/concepts/twrapconcept.nim
new file mode 100644
index 000000000..c3dea2ff9
--- /dev/null
+++ b/tests/concepts/twrapconcept.nim
@@ -0,0 +1,21 @@
+discard """
+  errormsg: "type mismatch: got <string>"
+  nimout: "twrapconcept.nim(10, 5) Foo: concept predicate failed"
+"""
+
+# https://github.com/nim-lang/Nim/issues/5127
+
+type
+  Foo = concept foo
+    foo.get is int
+
+  FooWrap[F: Foo] = object
+    foo: F
+
+proc get(x: int): int = x
+
+proc wrap[F: Foo](foo: F): FooWrap[F] = FooWrap[F](foo: foo)
+
+let x = wrap(12)
+let y = wrap "string"
+