-
Notifications
You must be signed in to change notification settings - Fork 21
Closed
Labels
Description
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 definitionval p = eis 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 _ : = => <<: <% >: # @