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

Fix #20146: attach the original name if there is an import selection for an indent #20163

Merged
merged 4 commits into from
May 6, 2024

Conversation

noti0na1
Copy link
Member

@noti0na1 noti0na1 commented Apr 11, 2024

Fix #20146

Attach the original name to the tree if there is an imported term selection for an indent.

@noti0na1 noti0na1 self-assigned this Apr 11, 2024
@noti0na1 noti0na1 marked this pull request as ready for review April 17, 2024 16:09
@noti0na1 noti0na1 changed the title [WIP] Fix #20146: attach the original name if there is an import selection for an indent Fix #20146: attach the original name if there is an import selection for an indent Apr 17, 2024
@noti0na1 noti0na1 requested a review from sjrd April 17, 2024 18:12
@noti0na1 noti0na1 assigned sjrd and unassigned noti0na1 Apr 17, 2024
compiler/src/dotty/tools/dotc/typer/Typer.scala Outdated Show resolved Hide resolved
compiler/src/dotty/tools/dotc/transform/CheckUnused.scala Outdated Show resolved Hide resolved
val termSelections = sels.flatMap(n => qual.tpe.member(n.name.toTermName).alternatives)
val sameTermPath = qual.isTerm && sym.exists && sym.owner.isType && qual.tpe.typeSymbol == sym.owner.asType
val selectionsToDealias = typeSelections ::: termSelections
val renamedSelection = if sameTermPath then sels.find(sel => sel.imported.name == sym.name) else None
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no equivalent to this line in the new code. Why did it disappear?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

renamedSelection is removed. As its name suggests, it tries to find renamed selections. However, I think this logic is redundant, because it just compare the names from sels with sym.name and ensure the path is valid, which will be done in selector later and has been ensured in typer.

@sjrd sjrd merged commit b0d32aa into scala:main May 6, 2024
19 checks passed
@sjrd sjrd deleted the fix-20146 branch May 6, 2024 11:49
@sjrd sjrd mentioned this pull request May 6, 2024
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur added a commit that referenced this pull request 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
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Spourious unused renamed import warning
3 participants