Nim/tests/converter/tor_in_converter.nim
Timothee Cour dfe51d10a1
addQuitProc now works with closures, and c, js(node/browser) backend; fix some bugs in testament (#14342)
* make addQuitProc great again

* fix bugs in testament

* fix test

* change 2016 => 2020

* addQuitProc => addExitProc + locks

* move to std/exitprocs
2020-06-16 11:43:48 +02:00

23 lines
373 B
Nim

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)