summary refs log tree commit diff stats
path: root/tests/converter
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2018-08-19 15:14:03 +0200
committerAndreas Rumpf <rumpf_a@web.de>2018-08-19 15:14:03 +0200
commit696c0c48c7c794453b79d2abf45c3f390a9b6fba (patch)
tree8a74e09ce97f64ea0e3377f6440a2e79d54ce0fd /tests/converter
parent7ac6462cbd30bcdb1c3805fbb06be13b3346ce2a (diff)
parentf2263cd129ff41259db99c68e98f966a681adf78 (diff)
downloadNim-696c0c48c7c794453b79d2abf45c3f390a9b6fba.tar.gz
fixes merge conflict
Diffstat (limited to 'tests/converter')
-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..793264434
--- /dev/null
+++ b/tests/converter/tconverter_with_constraint.nim
@@ -0,0 +1,20 @@
+
+discard """
+  file: "tconverter_with_constraint.nim"
+  line: 20
+  errormsg: "type mismatch: got <int>"
+"""
+
+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
\ No newline at end of file