const banana = join(["bana", "na"])
proc foo(arg:string): int = 0
macro foobar(arg: typed): stmt =
  # it's not the root node I am working on.
  let subNode = arg[1]
  echo subNode.treeRepr     # Sym "banana"
  echo subNode.getType.repr # string
  echo subNode.strVal       # Error: field 'strVal' cannot be found
  
  let sym = subNode.symbol
  echo sym.repr             # banana
  echo sym.kind             # Error: type mismatch: got (NimSym), expected macros.kind(n: NimNode)
  echo sym.strVal           # Error: type mismatch: got (NimSym), expected macros.strVal(n: NimNode)
foobar(foo(banana))I could implement my own eval that works on the const implementation, but I hope I do not need to eval something that the compiler already has evaluated for me at that time.
EDIT:
I found a solution. For some reason, getImpl doesn't get me the tree in the const declaration, but a string literal. Which I think I pretty weired, because It doesn't represent the AST in any way. But at least I can use it to get the string value of my symbol. So this is my solution:
macro foobar(arg: typed): stmt =
  let subNode = arg[1]
  echo subNode.symbol.getImpl.strVal