summary refs log tree commit diff stats
path: root/tests/converter
diff options
context:
space:
mode:
authorAndreas Rumpf <rumpf_a@web.de>2016-08-02 14:53:21 +0200
committerAndreas Rumpf <rumpf_a@web.de>2016-08-02 14:53:21 +0200
commit4d5c0027e6d9e7a70c79cd441043357fb270bff0 (patch)
tree6f81648301376f6c56b8cac2bcee3d5483ffa64a /tests/converter
parentde6198c747afc32a9bd41b70eb9d217054a916f0 (diff)
downloadNim-4d5c0027e6d9e7a70c79cd441043357fb270bff0.tar.gz
fixes #4537
Diffstat (limited to 'tests/converter')
-rw-r--r--tests/converter/tor_in_converter.nim23
1 files changed, 23 insertions, 0 deletions
diff --git a/tests/converter/tor_in_converter.nim b/tests/converter/tor_in_converter.nim
new file mode 100644
index 000000000..5674526a1
--- /dev/null
+++ b/tests/converter/tor_in_converter.nim
@@ -0,0 +1,23 @@
+discard """
+  output: '''test
+test'''
+"""
+# bug #4537
+
+# nim js --d:nodejs
+
+type
+  Str = distinct string
+
+when true:
+  # crashes
+  converter convert(s: string | cstring): Str = Str($s)
+else:
+  # works!
+  converter convert(s: string): Str = Str($s)
+  converter convert(s: cstring): Str = Str($s)
+
+proc echoStr(s: Str) = echo s.string
+
+echoStr("test")
+echoStr("test".cstring)