tor_in_converter.nim 373 B

123456789101112131415161718192021222324
  1. discard """
  2. output: '''test
  3. test'''
  4. """
  5. # bug #4537
  6. # nim js -d:nodejs
  7. type
  8. Str = distinct string
  9. when true:
  10. # crashes
  11. converter convert(s: string | cstring): Str = Str($s)
  12. else:
  13. # works!
  14. converter convert(s: string): Str = Str($s)
  15. converter convert(s: cstring): Str = Str($s)
  16. proc echoStr(s: Str) = echo s.string
  17. echoStr("test")
  18. echoStr("test".cstring)