Aladdin - Scala Bugtracking
[#296] project: compiler priority: low category: bug
submitter assigned to status date submitted
Michel Martin fixed 2004-02-13 10:30:13.0
subject Literal floating point values not as in Java
code
object bug {
  val v1 = 2.f;
  val v2 = 2.d;
}
what happened
The compiler complains
bug_scanner.scala:2: value f is not a member of scala.Int
  val v1 = 2.f;
            ^
bug_scanner.scala:3: value d is not a member of scala.Int
  val v2 = 2.d;
            ^
two errors found
what expected No complaints. The Scala reference claims that floating point literals are "like in Java", but here it's not the case. Both "2.f" and "2.d" are valid Java literals.
[back to overview]
Changes of this bug report
Stephane  edited on  2004-03-01 17:02:05.0
Changed scanner to also accept literals like "2." or "2.f" (as specified in the JLS)