summary refs log tree commit diff stats
path: root/tests/converter/tconverter_with_constraint.nim
diff options
context:
space:
mode:
Diffstat (limited to 'tests/converter/tconverter_with_constraint.nim')
-rw-r--r--tests/converter/tconverter_with_constraint.nim20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/converter/tconverter_with_constraint.nim b/tests/converter/tconverter_with_constraint.nim
new file mode 100644
index 000000000..ce5135586
--- /dev/null
+++ b/tests/converter/tconverter_with_constraint.nim
@@ -0,0 +1,20 @@
+
+discard """
+  errormsg: "type mismatch: got <int>"
+  file: "tconverter_with_constraint.nim"
+  line: 20
+"""
+
+type
+  MyType = distinct int
+
+converter to_mytype(m: int{lit}): MyType =
+  m.MyType
+
+proc myproc(m: MyType) =
+  echo m.int, ".MyType"
+
+myproc(1) # call by literal is ok
+
+var x: int = 12
+myproc(x) # should fail