| [#796] | project: compiler | priority: low | category: bug | |
|---|---|---|---|---|
| submitter | assigned to | status | date submitted | |
| Martin | Burak | fixed | 2006-11-03 17:50:07.0 | |
| subject | unapply problem with nested objects | |||
| code |
object Test extends Application {
object Twice {
def apply(x: int) = x * 2
def unapply(x: int): Option[Tuple1[int]] =
if (x % 2 == 0) Some(Tuple1(x / 2))
else None
}
def test(x: int) = x match {
case Twice(y) => "x is two times "+y
case _ => "x is odd"
}
Console.println(test(3))
Console.println(test(4))
}
|
|||
| what happened | |
|||
| what expected | The problem seems to be related to the fact that now Twice is nested inside Test. Compare with bug795, which passes the typechecker. | |||
| [back to overview] | ||||
| Martin edited on 2006-11-03 17:50:40.0 |
| Burak edited on 2006-11-10 19:00:35.0 |