Aladdin - Scala Bugtracking
[#130] project: compiler priority: medium category: feature
submitter assigned to status date submitted
Matthias Burak fixed 2003-09-11 14:33:46.0
subject Non-sequence patttern classified as sequence pattern
code
case class PT(x: PT) {
  def foo(x: Any) = x match {
    case PT(a@_) => System.out.println(a);
  }
}
what happened
PT.scala:3: empty sequence not allowed here
                case PT(a@_) => System.out.println(a);
                           ^
one error found
what expected I think the pattern above should be identical to
 case PT(a) => ...
Consequently, there should be no error message.
[back to overview]
Changes of this bug report
Burak  edited on  2003-09-12 12:17:12.0
This pattern parses as...
 
  case PT(@_(a, [])) 
@_ is a valid operator ident. [spec,p.11] and as (binary) operators in patterns are turned to constructors... the second argument is missing, so the empty sequence is assumed, which in its abbreviated form I do not allow as second argument. I will change the text of the error message though.
Burak  edited on  2003-09-12 15:32:32.0
Matthias  edited on  2003-09-16 14:27:10.0
I just restricted operator parsing in the scanner. Now, operators never contain the character '_'.