diff options
Diffstat (limited to 'tests/converter/tor_in_converter.nim')
-rw-r--r-- | tests/converter/tor_in_converter.nim | 23 |
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) |