Skip to content
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

even lighter version of #17938: fix most issues with UnusedImport, XDeclaredButNotUsed, etc; fix #17511, #17510, #14246 (without realModule) #18362

Merged

Conversation

timotheecour
Copy link
Member

@timotheecour timotheecour commented Jun 26, 2021

@timotheecour timotheecour force-pushed the pr_fix_used_conservative_norealmodule branch from 84c0855 to 6e4e579 Compare June 26, 2021 02:00
@timotheecour timotheecour marked this pull request as ready for review June 26, 2021 02:18
compiler/suggest.nim Outdated Show resolved Hide resolved
@timotheecour timotheecour added TODO: followup needed remove tag once fixed or tracked elsewhere Ready For Review (please take another look): ready for next review round labels Jun 26, 2021
@Araq Araq merged commit b8f761b into nim-lang:devel Jun 26, 2021
@timotheecour timotheecour deleted the pr_fix_used_conservative_norealmodule branch June 26, 2021 17:42
@timotheecour
Copy link
Member Author

timotheecour commented Jun 26, 2021

If at all this should be a hint, not a warning.

I'm ok changing to a hint, given that we have hintAsError

This PR generates a lot of valid warnings when compiling nim, eg:

  • Warning: imported and not used: 'platform' [UnusedImport])
  • docgen.nim(19, 14) Warning: redefinition of 'trees'; previous declaration here [...]

but also a few bad ones in cases like this:

import strutils except Letters
from os import nil

need to followup with a PR to handle those cases => #18366

Araq pushed a commit that referenced this pull request Jun 27, 2021
* warnDuplicateModuleImport => hintDuplicateModuleImport
* improve DuplicateModuleImport msg, add test
PMunch pushed a commit to PMunch/Nim that referenced this pull request 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
PMunch pushed a commit to PMunch/Nim that referenced this pull request Mar 28, 2022
…18366)

* warnDuplicateModuleImport => hintDuplicateModuleImport
* improve DuplicateModuleImport msg, add test
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Ready For Review (please take another look): ready for next review round TODO: followup needed remove tag once fixed or tracked elsewhere
Projects
None yet
3 participants