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
val 1 = 2 compiles #4939
Comments
Imported From: https://issues.scala-lang.org/browse/SI-4939?orig=1 |
@paulp said:
It's not so according to spec that one can redefine the literal 1. |
@paulp said: |
@SethTisue said (edited on Aug 24, 2011 2:29:27 PM UTC): There is much discussion of this issue at https://groups.google.com/forum/#!topic/scala-user/k57U6jt8Za0 Surely this is a bug though:
No error there at the end, just "OK boss!" Shall I open a separate ticket on it? Or shall we reopen this one? |
@SethTisue said: |
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)
The text was updated successfully, but these errors were encountered: