Hi,
I have a problem with 2 macros having the same name not working probably.
So at the moment I have:
macro qouteNode*(body: untyped): untyped
and
macro qouteNodeOp*(op: string, body: untyped): untyped
and it works just fine. But if I call both macros qouteNode, I get errors.
For a more detailed impression you can have a look at the code: https://github.com/choltreppe/nim_quote_node
The error message when giving both the same name and runnig tests is: >quote_nodes/tests/test1.nim(12, 28) Error: type mismatch: got <string, NimNode> >but expected one of: >proc `&`(x, y: string): string > first type mismatch at position: 2 > required type for y: string > but expression 'calc' is of type: NimNode >proc `&`(x: string; y: char): string > first type mismatch at position: 2 > required type for y: char > but expression 'calc' is of type: NimNode >proc `&`T: seq[T] > first type mismatch at position: 2 > required type for y: seq[T] > but expression 'calc' is of type: NimNode >4 other mismatching symbols have been suppressed; compile with --showAllMismatches:on to see them
Looking at the error message it think in the case of using qouteNode*(body: untyped) simply no macro is applied at all ?
Thanks, chol
I would assume that this problem is an instance of the case documented here: https://nim-lang.org/docs/manual.html#overload-resolution-lazy-type-resolution-for-untyped
Overloads which require that the type of a parameter is known trigger the resolution of that argument leading to the error message you received. There have however been attempts to improve this situation in the past (such as https://github.com/nim-lang/RFCs/issues/402).