|
[#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] |