Aladdin - Scala Bugtracking
[#220] project: _ priority: _ category: missing feature
submitter assigned to status date submitted
Burak Martin won't fix 2003-11-07 11:59:27.0
subject type inference for variables
code
object foo {
  var e = Nil;
  e = 1 :: e;
}
what happened
listinf.scala:3: no type parameters for method :: of type [b](b)scala.List[b] exist so that it can be applied to\
 arguments (scala.Int)
 --- because ---
result type scala.List[b] is incompatible with expected type scala.Nil
  e = 1 :: e;
        ^
one error found
what expected type inference could check for assignments within the scope and infer the type as the least upper bound of the right-hand sides.
[back to overview]
Changes of this bug report
Martin  edited on  2003-11-07 12:42:08.0
Would be nice top have, but local type inference does not accommodate this.