nim-lang/Nim

vm string literals do not work when generated by a macro

Closed this issue · 0 comments

Example

macro fooImpl(arg: untyped) =
  result = quote do:
    `arg`

proc foo(): string {.compileTime.} =
  fooImpl:
    result = "foo"
    result.addInt 4

static:
   echo foo()
   echo foo()
   echo foo()

Current Output

foo4
foo44
foo444

Expected Output

foo4
foo4
foo4

Additional Information

$ nim -v
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2019-11-14
Copyright (c) 2006-2019 by Andreas Rumpf

git hash: e69a69852b1028017139114a2444de83630c1505
active boot switches: -d:danger