import strformat
proc test[T](): T =
result *= 2
proc miauz[T](): T =
echo &"{test[string]()}"
miauz[int]()
Currently the diagonstics provider throws an exception with code like this because it cannot handle that there's no filename in the error log:
...\strformaterror.nim(2, 6) template/generic instantiation of `&` from here
(1, 1) Error: undeclared identifier: 'test'
candidates (edit distance, scope distance); see '--spellSuggest':
(2, 4): 'lent' [type declared in C:\Nim\lib\system.nim(307, 6)]
(2, 4): 'reset' [proc declared in C:\Nim\lib\system.nim(1000, 6)]
(2, 4): 'set' [type declared in C:\Nim\lib\system.nim(300, 3)]
I was thinking about putting in some fake filename, I thought that could be confusing, so I settled with repeating the last reported location instead (see also the comment in the code for rationale).
In an idea world, it would create an virtual file where you could see the generated code with the error in it, though then again parseExpr/parseStmt aren't used that often in Nim.
Consider these snippets:
Currently the diagonstics provider throws an exception with code like this because it cannot handle that there's no filename in the error log:
I was thinking about putting in some fake filename, I thought that could be confusing, so I settled with repeating the last reported location instead (see also the comment in the code for rationale).
In an idea world, it would create an virtual file where you could see the generated code with the error in it, though then again parseExpr/parseStmt aren't used that often in Nim.
Alternative ideas are welcome!