even lighter version of #17938: fix most issues with UnusedImport, XDeclaredButNotUsed, 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
This commit is contained in:
Timothee Cour 2021-06-26 06:21:46 -07:00 • committed by GitHub
commit b8f761b7e2
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
13 changed files with 155 additions and 60 deletions

View file

@ -67,6 +67,7 @@ type
warnResultUsed = "ResultUsed",
warnCannotOpen = "CannotOpen",
warnFileChanged = "FileChanged",
warnDuplicateModuleImport = "DuplicateModuleImport",
warnUser = "User",
# hints
hintSuccess = "Success", hintSuccessX = "SuccessX",
@ -148,6 +149,7 @@ const
warnResultUsed: "used 'result' variable",
warnCannotOpen: "cannot open: $1",
warnFileChanged: "file changed: $1",
warnDuplicateModuleImport: "$1",
warnUser: "$1",
hintSuccess: "operation successful: $#",
# keep in sync with `testament.isSuccess`