Aladdin - Scala Bugtracking
[#240] project: compiler priority: low category: missing feature
submitter assigned to status date submitted
Burak Burak won't fix 2003-11-27 16:45:14.0
subject nested pattern problem
code
object foo {  
   class Z;
  case class X( x:List[Z] ) extends Z;
  case class Y( s:String ) extends Z;

  // this does not work
  def lookupByName( pb:X, Name:String ):Option[String] = pb match {
    case X(List( _ *, 
                X( List( 
                  Y( Name ),
                  Y( variable ) 
                   ))
         )) =>
      Some( variable )
  }

/* // this works
  def lookupByName( pb:X, Name:String ):Option[String] = pb match {
    case X(List( _ *, 
                  Y( Name ),
                  Y( variable ) 
         )) =>
      Some( variable )
  }
*/

}
what happened
Exception in thread "main" java.lang.AssertionError: foo.lookupByName.leftTracer$0.matcher$12.variable
	at scalac.ast.TreeCloner.getSymbolFor(TreeCloner.java:68)
etc. etc.
	at scalac.ast.TreeCloner.transform(TreeCloner.java:83)
	at scalac.transformer.matching.RightTracerInScala._cur_match(RightTracerInScala.java:343)
	at scalac.transformer.matching.RightTracerInScala.code_delta(RightTracerInScala.java:378)
what expected nesting to work.
[back to overview]
Changes of this bug report
Burak  edited on  2003-11-27 16:45:39.0
typo
Burak  edited on  2003-11-27 16:46:00.0
status open
Burak  edited on  2006-09-19 20:03:50.0
This bug talks about regular patterns, which are disabled and it is unlikely that they will be reimplemented in the form they were implement before, that is prone to these sort of bugs due to hairy symbol juggling in the old scala compiler.