Skip to content

Import selector checks looks at left of arrow instead of right #18082

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

Closed
som-snytt opened this issue Jun 27, 2023 · 0 comments · Fixed by #18102
Closed

Import selector checks looks at left of arrow instead of right #18082

som-snytt opened this issue Jun 27, 2023 · 0 comments · Fixed by #18102
Milestone

Comments

@som-snytt
Copy link
Contributor

Compiler version

3.3.2-RC1-bin-SNAPSHOT-git-8948092

Minimized code

  ~ ~/projects/dotty/bin/scala
Welcome to Scala 3.3.2-RC1-bin-SNAPSHOT-git-8948092 (20.0.1, Java OpenJDK 64-Bit Server VM).
Type in expressions for evaluation. Or try :help.

scala> object O { val a = 1 }
// defined object O

scala> import O.{a=>b, a}
-- [E122] Syntax Error: ------------------------------------------------------------------------------------------------
1 |import O.{a=>b, a}
  |                ^
  |                a is renamed twice on the same import line.
1 error found

scala> import O.{a=>b, toString=>b}

scala>

Output

// as shown

Expectation

The aliasing import is fine, but introducing the same name twice is not.

The spec does not constrain import selectors, so technically any warning or error is a lint.

scala/bug#12813

@som-snytt som-snytt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jun 27, 2023
@odersky odersky removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Jun 28, 2023
odersky added a commit to dotty-staging/dotty that referenced this issue Jun 29, 2023
odersky added a commit that referenced this issue Jun 30, 2023
@Kordyjan Kordyjan added this to the 3.4.0 milestone Aug 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants