You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A.scala:7: error: recursive value x needs type
val id = x + 1 // !!! reports: recursive value x needs type
^
A.scala:5: warning: type-checking the invocation of method foo checks if the named argument expression 'id = ...' is a valid assignment
in the current scope. The resulting type inference error (see above) can be fixed by providing an explicit type in the local definition for id.
val x = foo(p = 2)
^
one warning found
one error found
Unfortunately, the warning message doesn't say that the "named argument expression 'id = ...'" was generated by the compiler and is not visible in the source code.
See: http://stackoverflow.com/questions/9148339/why-this-scala-code-reports-compilation-error-recursive-value-x-needs-type
Details:
The scala code is simple:
Please note the line:
Why it reports recursive value x needs type?
If I change the variable name, as:
It will be OK.
The text was updated successfully, but these errors were encountered: