Skip to content

val 1 = 2 compiles #4939

Closed
Closed
@scabug

Description

@scabug

The following code should not compile.

scala> object Foo { val 1 = 2 }
defined module Foo

Also, as been pointed out by Seth Tisue, the defined val shadows the corresponding integer literal, producing unexpected behavior:

scala> object O { val 1 = 2; def x = 1 }
defined module O

scala> O.x
scala.MatchError: 2 (of class java.lang.Integer)

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions