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

Open
wants to merge 4 commits into
base: main
Choose a base branch
from

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.

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
2 participants