-
- Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
It is typical to do something like (dirName, baseName, _) = splitFile("/a/b") where you do not care about that 3rd element of the tuple.
When that is used outside a template, as expected, the XDeclaredButNotUsed hint is not printed, good.
But when the same code is used inside a template, I get messages like:
Hint: '_`gensym722021' is declared but not used [XDeclaredButNotUsed]
CC: t.nim
Example
import os template foo() = let (dirName, baseName, _) = splitFile("/a/b") echo dirName echo baseName echo "The _ causes the XDeclaredButNotUsed hint to appear when this code is in a template" foo() let (dirName2, baseName2, _) = splitFile("/a/b") echo dirName2 echo baseName2 echo "When that _ is outside a template, it does not cause that Hint (which should be the case when inside a template too)"Current Output
/home/kmodi/sandbox/nim/bug_reports/declared_but_not_used/t.nim(5, 25) Hint: '_`gensym543021' is declared but not used [XDeclaredButNotUsed] Hint: [Link] Hint: operation successful (68333 lines compiled; 0.642 sec total; 90.695MiB peakmem; Debug Build) [SuccessX] Hint: /home/kmodi/sandbox/nim/bug_reports/declared_but_not_used/t [Exec] /a b The _ causes the XDeclaredButNotUsed hint to appear when this code is in a template /a b When that _ is outside a template, it does not cause that Hint (which should be the case when inside a template too) Expected Output
The same output, but that Hint should not appear.
Additional Information
$ nim -v Nim Compiler Version 0.20.99 [Linux: amd64] Compiled at 2019-08-28 Copyright (c) 2006-2019 by Andreas Rumpf git hash: 42d2e68bca2d7fce65591ed7c4697ed1ecf86026 active boot switches: -d:release Update (2021/06/10):
I re-confirm this issue on the latest devel:
Nim Compiler Version 1.5.1 [Linux: amd64] Compiled at 2021-06-10 Copyright (c) 2006-2021 by Andreas Rumpf git hash: 19918ceb2b099440cd3e43b6d7fff313de6a84a2 active boot switches: -d:release juancarlospaco