Open zedeus opened 5 years ago
Still an issue:
~/P/stuff ❯❯❯ nimsuggest --stdin --debug b.nim
Hint: used config file '/home/dian/Things/Nim/config/nim.cfg' [Conf]
Hint: used config file '/home/dian/Things/Nim/config/config.nims' [Conf]
Hint: used config file '/home/dian/nim.cfg' [Conf]
......usage: sug|con|def|use|dus|chk|mod|highlight|outline|known|project file.nim[;dirtyfile.nim]:line:col
type 'quit' to quit
type 'debug' to toggle debug mode on/off
type 'terse' to toggle terse mode on/off
> chk b.nim
.chk skUnknown Hint ??? 0 -1 "b [Processing]" 0
chk skUnknown Hint /home/dian/Projects/stuff/b.nim 11 0 "template/generic instantiation from here" 0
chk skUnknown Error /home/dian/Projects/stuff/b.nim 6 7 "key already exists: match" 0
If the macro is storing information across runs, then it'll run into issues. I suspect that this might extend beyond nimsuggest and also be an issue for any incremental complication or caching compilation. If there is cross run state it might be necessary that such macros need to account for being called repeatedly or be compile lifecycle aware as they're no longer idempotent.
If the macro is storing information across runs, then it'll run into issues.
Exactly. Which is why we created the "macrocache" API.
Using a macrocache.CacheTable results in a
key already exists error
. Example:Minimal example:
It's not related to the NimNode argument, this throws same error:
When not called from inside a macro, the error isn't triggered: