Aladdin - Scala Bugtracking
[#840] project: specification priority: low category: missing feature
submitter assigned to status date submitted
Sean Martin open 2006-11-26 16:50:46.0
subject matching on super-case class broken
code
// test/pending/pos/bug112606B.scala
package test;
trait Test2 {
  case class Token(text : String);
  class KeywordToken(text : String) extends Token(text);
  def decode(tok : KeywordToken) = tok match {
  // constructor cannot be instantiated to expected type;
  //  found   : Test2.this.Token
  //  required: Test2.this.KeywordToken	
  case Token("final") => true;   
  }
}
what happened
Doesn't compile. 
what expected Should compile, how else can we take advantage of the convenient case class matching syntax? Work around: upcast tok to Token before match.
[back to overview]
Changes of this bug report
Martin  edited on  2006-12-01 11:53:54.0
It's still speced that way, so I reclassify as missing feature.
Sean  edited on  2006-12-01 13:31:58.0
Martin  edited on  2006-12-01 16:09:56.0