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
scala> { val_="foo"; val_="bar"; }
<console>:8:error: _ is already defined as value _
{ val_="foo"; val_="bar"; }
^
The error should not be present, because _ is not a simple identifier but a pattern.
In Scala Language Specification 4.1 Value Declarations and Definitions
If p is some pattern other than a simple name or a name followed by a colon and a type,
then the value definition val p = e is expanded as follows:
3. If p has no bound variables:
e match { case p => ()}
In Scala Language Specification 1.1 Identifiers
The following names are reserved words instead of being members of the syntactic class id of lexical identifiers.
abstract case catch class def
do else extends false final
finally for forSome if implicit
import lazy match new null
object override package private protected
return sealed super this throw
trait try true type val
var while with yield
_ : = => <<:
<% >: # @
The text was updated successfully, but these errors were encountered:
The error should not be present, because
_
is not a simple identifier but a pattern.In Scala Language Specification 4.1 Value Declarations and Definitions
In Scala Language Specification 1.1 Identifiers
The text was updated successfully, but these errors were encountered: