-
-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Incorrect UnusedImport
warning in presence of import foo as bar
#17511
Comments
Araq
pushed a commit
that referenced
this issue
Jun 26, 2021
…eclaredButNotUsed, etc; fix #17511, #17510, #14246 (without realModule) (#18362) * {.used: symbol} * add tests * fix tests with --import * --import works without giving spurious unused warnings * new warning warnDuplicateModuleImport for `import foo; import foo` * fix test, add resolveModuleAlias, use proper line info for module aliases * fix spurious warnings * fix deprecation msg for deprecated modules even with `import foo as bar` * disable a test for i386 pending sorting XDeclaredButNotUsed errors * UnusedImport now works with re-exported symbols * fix typo [skip ci] * ic support * add genPNode to allow writing PNode-based compiler code similarly to `genAst` * fix DuplicateModuleImport warning * adjust test * fixup * fixup * fixup * fix after rebase * fix for IC * keep the proc inline, move the const out * [skip ci] fix changelog * experiment: remove calls to resolveModuleAlias * followup * fixup * fix tests/modules/tselfimport.nim * workaround tests/deprecated/tmodule1.nim * fix properly * simplify
PMunch
pushed a commit
to PMunch/Nim
that referenced
this issue
Mar 28, 2022
…port, XDeclaredButNotUsed, etc; fix nim-lang#17511, nim-lang#17510, nim-lang#14246 (without realModule) (nim-lang#18362) * {.used: symbol} * add tests * fix tests with --import * --import works without giving spurious unused warnings * new warning warnDuplicateModuleImport for `import foo; import foo` * fix test, add resolveModuleAlias, use proper line info for module aliases * fix spurious warnings * fix deprecation msg for deprecated modules even with `import foo as bar` * disable a test for i386 pending sorting XDeclaredButNotUsed errors * UnusedImport now works with re-exported symbols * fix typo [skip ci] * ic support * add genPNode to allow writing PNode-based compiler code similarly to `genAst` * fix DuplicateModuleImport warning * adjust test * fixup * fixup * fixup * fix after rebase * fix for IC * keep the proc inline, move the const out * [skip ci] fix changelog * experiment: remove calls to resolveModuleAlias * followup * fixup * fix tests/modules/tselfimport.nim * workaround tests/deprecated/tmodule1.nim * fix properly * simplify
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When module
bar
imports and exports modulefoo
(here,sequtils
) usingimport ... as ...
and modulebaz
importsbar
to get access tofoo
, either one or twoUnusedImport
warning is emitted, depending on Nim version.Example
test.nim
:test2.nim
:Current Output
Older versions also display variations of this behavior.
1.4.2:
1.2.6:
1.0.4:
Expected Output
No incorrect
UnusedImport
warning(s).Additional Information
#17510 is related, but only appears after Nim 1.4.2 and doesn't need
import foo as bar
/export bar
, justimport foo
/export foo
.The text was updated successfully, but these errors were encountered: