summary refs log blame commit diff stats
path: root/tests/converter/tor_in_converter.nim
blob: df2334647076ab9a46adaaabb43e4e8964c4e7e7 (plain) (tree)
1
2
3
4
5
6
7





                 
                  















                                                       
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)