Aladdin - Scala Bugtracking
[#434] project: compiler priority: low category: missing feature
submitter assigned to status date submitted
Gilles Martin won't fix 2005-05-27 16:58:47.0
subject Match value not typed in body of case with type constraint
code
def tata (a: Any): String = a match {
  case a1:String => a
  case _ => ""
}
what happened
An error is reported for "a" on line 2:
type mismatch;
  found   : scala.Any
  required: java.lang.String

If the faulty "a" is replaced by "a1", it works fine.
what expected No error. The type inference mechanism should know that "a" is a string in the body of the first match case.
[back to overview]
Changes of this bug report
Burak  edited on  2005-05-27 17:12:55.0

We have had this one before :-) see #215 by Vincent.

Gilles  edited on  2005-06-07 15:41:05.0