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

Spourious unused renamed import warning #20146

Closed
nicolasstucki opened this issue Apr 10, 2024 · 2 comments · Fixed by #20163
Closed

Spourious unused renamed import warning #20146

nicolasstucki opened this issue Apr 10, 2024 · 2 comments · Fixed by #20163
Assignees
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@nicolasstucki
Copy link
Contributor

Compiler version

3.3.3, 3.4.0,

Minimized code

//> using options -Wunused:all

def test(list: List[Int]): Int =
  import list.{head => first}
  first

Output

4 |  import list.{head => first}
  |               ^^^^^^^^^^^^^
  |               unused import

Expectation

Should not warn

@nicolasstucki nicolasstucki added itype:bug area:linting Linting warnings enabled with -W or -Xlint labels Apr 10, 2024
@nicolasstucki nicolasstucki added the regression This worked in a previous version but doesn't anymore label Apr 10, 2024
@nicolasstucki
Copy link
Contributor Author

Found regression in ReactiveMongo/ReactiveMongo#1297.

@noti0na1
Copy link
Member

When importing a term and renaming it, we will translate the usage of the renamed term into the original selection in typer.

In this case, first becomes list.head; hence, the import checker couldn't find the usage of first.

sjrd added a commit that referenced this issue May 6, 2024
…for an indent (#20163)

Fix #20146

Attach the original name to the tree if there is an imported term
selection for an indent.
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur added a commit that referenced this issue Jul 6, 2024
…selection for an indent" to LTS (#21095)

Backports #20163 to the LTS branch.

PR submitted by the release tooling.
[skip ci]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:linting Linting warnings enabled with -W or -Xlint itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
3 participants