You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The following example results in an unused import warning being incorrectly reported.
Example
Two small modules are involved in this example.
first.nim:
import tables, second
templatetest(key: int): int=
data[key]
echotest(1)
second.nim:
import tables
let data*= {1: 2, 3: 4}.toTable
Build with nim c first.nim.
Current Output
Among the usual compiler output:
first.nim(1, 16) Warning: imported and not used: 'second' [UnusedImport]
Expected Output
Since data is used, that warning should not appear. Removing the import as the warning suggests causes the program to fail to compile.
Additional Information
The incorrect unused import warning does not appear if any one of these is true:
The template is a proc instead
The template's body is changed to data.len
The table was replaced with something simpler such as let x* = 5, and the template's body was changed to just x
Output of nim -v:
Nim Compiler Version 1.1.1 [Linux: amd64]
Compiled at 2019-12-12
Copyright (c) 2006-2019 by Andreas Rumpf
git hash: 94289161f9dd00b2fc3070b08895a3b6c557ef44
active boot switches: -d:release
Also occurs with 1.0.4.
The text was updated successfully, but these errors were encountered:
The following example results in an unused import warning being incorrectly reported.
Example
Two small modules are involved in this example.
first.nim:
second.nim:
Build with
nim c first.nim
.Current Output
Among the usual compiler output:
Expected Output
Since
data
is used, that warning should not appear. Removing the import as the warning suggests causes the program to fail to compile.Additional Information
The incorrect unused import warning does not appear if any one of these is true:
data.len
let x* = 5
, and the template's body was changed to justx
Output of
nim -v
:Also occurs with 1.0.4.
The text was updated successfully, but these errors were encountered: