[#927] | project: compiler | priority: low | category: bug | |
---|---|---|---|---|
submitter | assigned to | status | date submitted | |
Burak | Martin | fixed | 2007-01-30 22:07:22.0 | |
subject | unapply does not work for selects | |||
code |
// Lex found this (object Stream.cons is new, but currently does not work due to) // library has now // Stream { ... object cons { ... apply,unapply ... }} object StreamFoo extends TestCase("unapply for Streams") with Assert { def sum(stream: Stream[int]): int = stream match { case Stream.empty => 0 case Stream.cons(hd, tl) => hd + sum(tl) } val str: Stream[int] = Stream.fromIterator(List(1,2,3).elements) assertEquals(sum(str), 6) } |
|||
what happened | tsf-wpa-2-030:~/Documents/svn/scala buraq$ build/quick/bin/scalac -d /tmp /tmp/str.scala /tmp/str.scala:9: error: type cons is not a member of object scala.Stream case Stream.cons(hd, tl) => hd + sum(tl) ^ /tmp/str.scala:9: error: not found: value hd case Stream.cons(hd, tl) => hd + sum(tl) ^ two errors found |
|||
what expected | this to work. I tried to hack typedSelect in the analogous manner to typedIdent. But then other unapplySeq patterns don't work (manifested in compiling ProcInstr).
We should have a look at this together.
Maybe related to some inconsistency regarding use of term names / type names |
|||
[back to overview] |
Martin edited on 2007-01-31 17:09:37.0 |