-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Parser error resulting in "overloaded or recursive method needs return type" #3737
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
Comments
Minimization object Main {
object Foo {
def foo(a : Int)(b: Int): Unit = ()
}
Foo foo(1)(2)
}
|
|
The only issue I see here is the weird error message: scala> 1(2)
1 |1(2)
|^
|overloaded or recursive method <none> needs return type The actual parsing is done exactly like scalac, changing the way we parse infix operators will require someone to come up with a specification of the changes and some good motivation. |
The error message is a bit clearer in 2.12.4 scala> (1)(2)
<console>:12: error: Int(1) does not take parameters
(1)(2)
^ |
Yes, this example was also added to an existing ticket on the scalac issue tracker: scala/bug#8859
Can you point me where in the spec I can find this (the error) is the required behavior? |
I should mention I have a use-case for this, but it's not a major-one to create a SIP and change the current intended behavior. I just wish for a confirmation that this is indeed the intended behavior, and I will close this issue. (and I can create a separate issue for the weird error message just for |
The syntax is described at http://www.scala-lang.org/files/archive/spec/2.12/13-syntax-summary.html for 2.12 and http://dotty.epfl.ch/docs/internals/syntax.html for dotty. I think the current behavior matches the syntax description. Parsing |
OK. After further thinking about this, I believe this is the required behavior. I'll open a new issue for the error message. |
I also created a scastie link with the code.
Using
-Xprint:parser
, gives the following:The text was updated successfully, but these errors were encountered: