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

Confusing error for constructor proxy shadowing #17153

Closed
odersky opened this issue Mar 27, 2023 · 1 comment · Fixed by #17154
Closed

Confusing error for constructor proxy shadowing #17153

odersky opened this issue Mar 27, 2023 · 1 comment · Fixed by #17154
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc
Milestone

Comments

@odersky
Copy link
Contributor

odersky commented Mar 27, 2023

Compiler version

3.3.0

Minimized example

class Number(n: Int)
val x = Number(3)

Output

2 |val x = Number(3)
  |        ^^^^^^
  |        Reference to constructor proxy for class Number
  |        shadows outer reference to object Number in package java.lang

Expectation

  1. java.lang.Number cannot possibly be applied, so one could avoid the error
  2. The error message could be better and could contain some suggestions how to fix the problem.
@odersky odersky added stat:needs triage Every issue needs to have an "area" and "itype" label area:reporting Error reporting including formatting, implicit suggestions, etc and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Mar 27, 2023
@Kordyjan Kordyjan added this to the 3.3.1 milestone Aug 1, 2023
@piotrborek
Copy link

I just wanted to point out that this code compiles and run with no error

'class Number(n: Int)
val x = new Number(3)'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:reporting Error reporting including formatting, implicit suggestions, etc
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants