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

Warn on bad extensions of effectively final aliases #22233

Open
som-snytt opened this issue Dec 18, 2024 · 0 comments
Open

Warn on bad extensions of effectively final aliases #22233

som-snytt opened this issue Dec 18, 2024 · 0 comments
Labels
area:extension-methods area:linting Linting warnings enabled with -W or -Xlint itype:bug

Comments

@som-snytt
Copy link
Contributor

Compiler version

3.6.2

Minimized code

//extension (s: java.lang.String) def length = 42 // warn
extension (s: String) def length = 42 // nowarn

Output

-- [E194] Potential Issue Warning: .../no-extension.scala:2:36 --
2 |extension (s: java.lang.String) def length = 42
  |                                    ^
  |Extension method length will never be selected
  |because String already has a member with the same name and compatible parameter types.

Expectation

The Scala alias should also warn, obviously.

Noticed at #17821.

@som-snytt som-snytt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label area:linting Linting warnings enabled with -W or -Xlint and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Dec 18, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:extension-methods area:linting Linting warnings enabled with -W or -Xlint itype:bug
Projects
None yet
Development

No branches or pull requests

2 participants