You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
OndrejSpanel
changed the title
False position: unused import when var symbol is used only as assignment target
False positive warning: unused import when var symbol is used only as assignment target
Apr 11, 2025
Fixes#22970
Simple example showing how awkward this is compared to a traversal,
where there is more control when descending.
Previously, it "ignored" the LHS of Assign to avoid taking `x = y` as
ref to `x` instead of assignment to.
Now, "mark" the LHS as assignment, so `transformIdent` and `Select` set
a "mode" flag, such that `x` is correctly taken as either a ref or
assign to `x`.
Probably there is more complex syntax to handle as LHS, but I haven't
had coffee yet.
tgodzik
pushed a commit
to scala/scala3-lts
that referenced
this issue
May 12, 2025
Fixesscala#22970
Simple example showing how awkward this is compared to a traversal,
where there is more control when descending.
Previously, it "ignored" the LHS of Assign to avoid taking `x = y` as
ref to `x` instead of assignment to.
Now, "mark" the LHS as assignment, so `transformIdent` and `Select` set
a "mode" flag, such that `x` is correctly taken as either a ref or
assign to `x`.
Probably there is more complex syntax to handle as LHS, but I haven't
had coffee yet.
[Cherry-picked 9bee756]
odersky
pushed a commit
to dotty-staging/dotty
that referenced
this issue
May 12, 2025
Fixesscala#22970
Simple example showing how awkward this is compared to a traversal,
where there is more control when descending.
Previously, it "ignored" the LHS of Assign to avoid taking `x = y` as
ref to `x` instead of assignment to.
Now, "mark" the LHS as assignment, so `transformIdent` and `Select` set
a "mode" flag, such that `x` is correctly taken as either a ref or
assign to `x`.
Probably there is more complex syntax to handle as LHS, but I haven't
had coffee yet.
Compiler version
3.7.0-RC1
3.7.0-RC2
Minimized code
Compile with
-Wunused:imports
:Output
Expectation
The warning should not be there. The code requires the import to compile.
The text was updated successfully, but these errors were encountered: