-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
-Wunused:all
causes a compilation error
#16650
Labels
Milestone
Comments
tgodzik
added
itype:bug
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Jan 10, 2023
tgodzik
added a commit
to tgodzik/metals
that referenced
this issue
Jan 10, 2023
Previously, this was ignored, but with a recent merge this started to actually be calculated, but unfortunately it fail for out specific scenario. Now, I disable -Wunused:all until scala/scala3#16650 is fixed.
szymon-rd
added
area:transform
and removed
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Jan 10, 2023
szymon-rd
added
prio:blocker
regression
This worked in a previous version but doesn't anymore
and removed
prio:blocker
labels
Jan 10, 2023
tgodzik
added a commit
to scalameta/metals
that referenced
this issue
Jan 10, 2023
Previously, this was ignored, but with a recent merge this started to actually be calculated, but unfortunately it fail for out specific scenario. Now, I disable -Wunused:all until scala/scala3#16650 is fixed.
Dale found Martin's writeup at #7650 which is useful background. (And toplevel definitions are in play because that's what opaque types desugar to, in part. |
tgodzik
added a commit
to scalameta/metals
that referenced
this issue
Jan 12, 2023
Previously, this was ignored, but with a recent merge this started to actually be calculated, but unfortunately it fail for out specific scenario. Now, I disable -Wunused:all until scala/scala3#16650 is fixed.
szymon-rd
added a commit
that referenced
this issue
Jan 12, 2023
… owner (also fix false positive for enum) (#16661) This solves the issue #16650. The issue is that `member(sym.name)` failed to resolve when a type contains multiple identical name. Here the `dotty.tools.dotc.util` package contains multiple "<init>" (constructor), so `member` fail to resolve the name The solution is to register the owner of the contructor instead of the constructor itself. :warning: I couldn't create a test where this appends, I tested it by `publishLocal` and testing the code in a different project with this code from #16650 (also didn't check on the metals build): ```scala //> using lib "org.scala-lang::scala3-compiler:3.3.0-RC1-bin-20230109-f56089b-NIGHTLY" //> using scala "3.3.0-RC1-bin-20230109-f56089b-NIGHTLY" //> using option "-Wunused:all" import dotty.tools.dotc.util.LinearSet @main def run = val a = 123 println("Hello!") ``` ```bash sbt> run [info] compiling 1 Scala source to .../target/scala-3.3.0-RC1-bin-SNAPSHOT/classes ... [warn] -- Warning: ..../src/main/scala/Main.scala:5:29 [warn] 5 |import dotty.tools.dotc.util.LinearSet [warn] | ^^^^^^^^^ [warn] | unused import [warn] -- Warning:.../src/main/scala/Main.scala:10:6 [warn] 10 | val a = 123 [warn] | ^ [warn] | unused local definition [warn] two warnings found [info] running run Hello! ``` ### EDIT Also add a related fix for import generated by enum (false positive)
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
Compiler version
Started probably with
3.3.0-RC1-bin-20230109-f56089b-NIGHTLY
and related to #16157Minimized code
I think it's more about the classpath than it is about a specific code.
Output
In the example:
Expectation
Compilation passes and shows unused warnings for
a
andLineraSet
The text was updated successfully, but these errors were encountered: