Aladdin - Scala Bugtracking
[#833] project: compiler priority: low category: bug
submitter assigned to status date submitted
Burak Martin fixed 2006-11-21 16:12:56.0
subject unapply code needs call to memberType?
code
// error with -Xunapply, (because of missing call to memberType?)

trait Gunk[a] {

  type Seq

  object Cons {
    def unapply(s: Seq) = unapply_Cons(s)
  }
  def unapply_Cons(s: Any): Option[Tuple2[a, Seq]]
}  

class Join[a] extends Gunk[a] {
  type Seq = JoinSeq

  abstract class JoinSeq
  case class App(xs: Seq, ys: Seq) extends JoinSeq

  def append(s1: Seq, s2: Seq): Seq = s1 // mock implementation

  def unapply_Cons(s: Any) = s match {
    case App(Cons(x, xs), ys) => Some(Pair(x, append(xs, ys)))
    case _ => null
  }
}
what happened
compile with -Xunapply
/tmp/typeGunk.scala:20 error: type mismatch;
 found   : Join.this.JoinSeq
 required: Gunk.this.Seq
    case App(Cons(x, xs), ys) => Some(Pair(x, append(xs, ys)))
             ^
/tmp/typeGunk.scala:20 error: not found: value x
    case App(Cons(x, xs), ys) => Some(Pair(x, append(xs, ys)))
                                           ^
/tmp/typeGunk.scala:20 error: not found: value xs
    case App(Cons(x, xs), ys) => Some(Pair(x, append(xs, ys)))
                                                     ^
three errors found
what expected I guess this should go through... I added the file in test/pending/pos/unapplyNeedsMemberType.scala for testing
[back to overview]
Changes of this bug report
Martin  edited on  2006-12-06 15:25:36.0
It was in the code of typedIdent, where we need to keep more than just the symbol.