-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
compiler should generate error "method foo1 in class C must be called with () argument" for inherited nullary method without arguments that has extra overloaded function in child class #21207
Comments
BTW, just in case, is |
cc @sjrd |
This issue was picked for the Scala Issue Spree of Tuesday, July 23rd. @aherlihy, @EugeneFlesselle and @hamzaremmal will be working on it. If you have any insight into the issue or guidance on how to fix it, please leave it here. |
Stepping through
In the case of
In the case of
We could try adding a 5th condition: that |
What are the next steps to solve this issue? @EugeneFlesselle, should we do what you suggest above, or does that need to be further discussed? |
IIRC it would quite tricky to find a combination of conditions s.t.
|
Scala 3.3.3 (same with 3.5.1-RC1)
I am using the language specification at 1 & 2 & 3.
Use the code below:
(It might be convenient to use worksheet to see the evaluation result)
Notice that
c.foo1
compiles fine and evaluates to1
However for
c.foo2
andc.foo3
compiler generates a syntax error:method foo3 in class C must be called with () argument
According to spec the compiler should also generate an error for
c.foo1
:method foo1 in class C must be called with () argument
The exclusion can be Java methods, but
foo1
is not defined in Java and not overridden.Note that if you remove
def foo1(x: Int): Int = 11
then the error IS generated.It seems like the check if
foo1
has some parameters somehow interleaves with overloading resolution and is done beforedef foo1(x: Int): Int
is discardedThe text was updated successfully, but these errors were encountered: