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

Check import selectors at Typer #15477

Merged
merged 1 commit into from
Jun 19, 2022
Merged

Check import selectors at Typer #15477

merged 1 commit into from
Jun 19, 2022

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Jun 19, 2022

Import selectors were checked at PostTyper before, but that can lead
to confusion when a type error results from a bad import selector.

Fixes #15468

Import selectors were checked  at PostTyper before, but that can lead
to confusion when a type error results from a bad import selector.

Fixes scala#15468
@odersky odersky marked this pull request as ready for review June 19, 2022 17:48
@odersky odersky requested a review from som-snytt June 19, 2022 19:52
Copy link
Contributor

@som-snytt som-snytt left a comment

Choose a reason for hiding this comment

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

The tests show this is a good change. There was a pre-pandemic ticket on Scala 2 to refcheck imports: the use case was an unused import where the import was deprecated, but the deprecation is not reported. I tried it out here and noticed that importing from a deprecated thing is not reported in Scala 3. I'll create a ticket.

@som-snytt
Copy link
Contributor

It's not obvious to me that one of these is more wrong.

  import X.{x => a, x => b}
  import X.{x => a}, X.{x => b}

If anything, the first form of aliasing is less wrong because the duplication is obvious. In the second form, or if the second import is much later in the source, the duplication is probably an accident; an exact duplicate would be benign shadow.

@odersky odersky merged commit 1f813bc into scala:main Jun 19, 2022
@odersky odersky deleted the fix-15468 branch June 19, 2022 21:24
@Kordyjan Kordyjan added this to the 3.2.1 milestone Aug 1, 2023
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.

Local imports occasionally don't work
3 participants