Thread overview | ||||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|---|
|
September 22 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 --- Comment #1 from Manu <turkeyman@gmail.com> --- I don't know any other language that can't do this, and people expect it to be available. We've had this in C# for over 20 years, and Java for much longer... we need this. It's an embarrassing omission. -- |
September 22 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 Lance Bachmeier <lance@lancebachmeier.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |lance@lancebachmeier.com --- Comment #2 from Lance Bachmeier <lance@lancebachmeier.com> --- (In reply to Manu from comment #0) > This has come up before... but I seriously, desperately want this. > Detecting unused imports is most important to improve build times. > I periodically try and cull old imports to improve build times, but it's > difficult to do, and just a massive waste of time! > > I know people don't like warnings; but this is exactly what warnings should be for. Atila started a related thread a couple months ago: https://forum.dlang.org/post/uosaqeqcwvdbzuafjehh@forum.dlang.org There was a tool posted in that thread that identifies unused global imports: https://forum.dlang.org/post/xlggsjttounitndnecgw@forum.dlang.org -- |
September 23 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 ryuukk_ <ryuukk.dev@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |ryuukk.dev@gmail.com --- Comment #3 from ryuukk_ <ryuukk.dev@gmail.com> --- It should be builtin into the compiler People should learn to submit PRs to DMD In odin it is as simple as passing: -vet-unused-imports Checks for unused import declarations. Nobody wants to download external programs for such a basic, yet important, feature -- |
September 23 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 --- Comment #4 from Lance Bachmeier <lance@lancebachmeier.com> --- (In reply to ryuukk_ from comment #3) > It should be builtin into the compiler > > People should learn to submit PRs to DMD > > In odin it is as simple as passing: > > -vet-unused-imports > Checks for unused import declarations. > > > > Nobody wants to download external programs for such a basic, yet important, feature It's Razvan's script, so the problem is not lack of understanding of how to submit PRs. His post notes cases that will be hard to handle. -- |
September 24 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 RazvanN <razvan.nitu1305@gmail.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |razvan.nitu1305@gmail.com --- Comment #5 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to Lance Bachmeier from comment #4) > (In reply to ryuukk_ from comment #3) > > It should be builtin into the compiler > > > > People should learn to submit PRs to DMD > > > > In odin it is as simple as passing: > > > > -vet-unused-imports > > Checks for unused import declarations. > > > > > > > > Nobody wants to download external programs for such a basic, yet important, feature > > It's Razvan's script, so the problem is not lack of understanding of how to submit PRs. His post notes cases that will be hard to handle. I was trying to implement it using dmd as a library to see if it's possible, and if not to understand what changes are required to make it possible. Implementing this inside the compiler would actually be easier, provided that Walter does not oppose it. -- |
September 24 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 --- Comment #6 from RazvanN <razvan.nitu1305@gmail.com> --- Here's the dmd implementation: https://github.com/dlang/dmd/pull/16878 -- |
September 24 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 --- Comment #7 from Dlang Bot <dlang-bot@dlang.rocks> --- @RazvanN7 updated dlang/dmd pull request #16878 "Implement warnings for unused imports" mentioning this issue: - Add changelog entry + fix importc error + Fix Bugzilla Issue 24778 https://github.com/dlang/dmd/pull/16878 -- |
September 24 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 basile-z <b2.temp@gmx.com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |b2.temp@gmx.com --- Comment #8 from basile-z <b2.temp@gmx.com> --- RazvanN: I dont like how it's implemented. I remember I already suggested that in a forum discussion but, let's do it again: If it's implemented in the compiler it would be better to implements this as a "touched" system. You see when searching a symbol has worked and via an import, you flag that import as "touched". Then when the user asks for unused import you visit the tree and when it's an import node and that import has not been touched you emit the warning. -- |
September 24 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 --- Comment #9 from RazvanN <razvan.nitu1305@gmail.com> --- (In reply to basile-z from comment #8) > RazvanN: I dont like how it's implemented. > > I remember I already suggested that in a forum discussion but, let's do it again: > > If it's implemented in the compiler it would be better to implements this as a "touched" system. You see when searching a symbol has worked and via an import, you flag that import as "touched". > > Then when the user asks for unused import you visit the tree and when it's an import node and that import has not been touched you emit the warning. I am fully aware how to implement it. In fact you can see that my implementation does the same thing, however, in dmdlib you do not have all the information that the compiler does (yet, I hope). -- |
September 24 [Issue 24778] Warning for unused imports | ||||
---|---|---|---|---|
| ||||
https://issues.dlang.org/show_bug.cgi?id=24778 --- Comment #10 from basile-z <b2.temp@gmx.com> --- Sorry I was looking for a `search` overrides modified in dmodule.d but now I remember that you have removed it a few months ago. -- |
Copyright © 1999-2021 by the D Language Foundation