Aladdin - Scala Bugtracking
[#421] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Martin fixed 2005-04-19 12:56:58.0
subject analyzer does not catch ill-typed regular patterns
code
object foo  {
  case class Bar(a:String, b:Object, c:String*);


  Bar("foo","meets","bar").match {
    case Bar("foo",_*) => error("huh?");
  }

}
what happened
new foo.this.Bar.this("foo", "meets", Array[java.lang.String]{"bar"}) match List(case (java.lang.String,java.lan\
g.Object,scala.Seq[java.lang.String])foo.this.Bar("foo", (_)*, Array[java.lang.String]{}) => scala.this.Predef.e\
rror("huh?"))
bug421.scala:4 error: regular expressions not yet implemented
  Bar("foo","meets","bar") match {
     ^
one error found
what expected The pattern is clearly incorrect (regular patterns are only allowed to be used in iterated parameter positions), so: a proper error message.
[back to overview]
Changes of this bug report
Martin  edited on  2006-05-27 13:19:21.0
You get now: "error: regular expressions not yet implemented". Not ideal, but it's an error. I set it to closed for now.
Burak  edited on  2006-07-01 17:17:04.0
The error is not related to pattern matching at all, and the error message is misleading.
Why should this bug be closed? I reopened it, with the "what happened" reflecting the current error message and changed the "what expected" field to a proper error message.
I maintain my argument that the pattern matcher should never see such erroneous patterns, or alternatively that some preceding phase does the necessary magic and expands them to the right signature Bar("foo",_,_*)
I also change the priority to low, because it's quite unlikely to run into this weirdness.
Martin  edited on  2006-10-30 19:19:34.0