[#508] | project: compiler | priority: high | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Stephane | Burak | fixed | 2005-12-13 18:53:38.0 | |
subject | Wrong pattern matching | |||
code |
case class Operator(x: Int); object test { val EQ = new Operator(2); def main(args: Array[String]): Unit = { val x = Pair(EQ, 0); analyze(x); // should print "0" val y = Pair(EQ, 1); analyze(y); // should print "1" val z = Pair(EQ, 2); analyze(z); // should print "2" } def analyze(x: Pair[Operator, Int]) = x match { case Pair(EQ, 0) => Console.println("0") case Pair(EQ, 1) => Console.println("1") case Pair(EQ, 2) => Console.println("2") case _ => Console.println("undefined on " + x) } } |
|||
what happened | 0 undefined on (Operator(2),1) undefined on (Operator(2),2) |
|||
what expected | 0 1 2 |
|||
[back to overview] |
Burak edited on 2005-12-15 11:14:43.0 |
fixed -- in old scalac, symbols for Apply nodes are obtained using TreeInfo.methSym (the symbol for the Apply node itself begin null, added ugly hack that takes this into account.)
|
Burak edited on 2005-12-15 11:14:51.0 |