Aladdin - Scala Bugtracking
[#999] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Burak fixed 2007-03-13 10:25:32.0
subject [contrib #373] Compiler crash on implicits with unapply
code
object Foo {
        def unapply(a : Int)(implicit b : Int) : Option[Int] = Some(a + b)
}

object Test {
        def main(argv : Array[String]) = {
                implicit val b = 3
                4 match {
                        case Foo(x) => Console.println(x)
                }
        }
}
what happened
'scala.tools.nsc.symtab.Types$TypeError: wrong number of arguments for method unapply: (scala.Int,scala.Int)scal\
a.Option'... (full trace is long)
what expected Compiles and prints 7 preferably, otherwise a compile-time error.
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-03-13 10:26:00.0
contribution #373
Martin  edited on  2007-03-14 15:44:40.0
I fixed uncurry. Now Foo is correctly uncurried, but the PatterNacther dies because Foo.unapply has two parameters. Reassigned to Burak to finish the fix.
Martin  edited on  2007-04-25 22:14:31.0
Martin  edited on  2007-04-29 14:33:23.0
Burak  edited on  2007-07-06 12:10:28.0
i fixed this now. it was hard to fix earlier, because the old algorithm was such a terrible hack. in fact implicits provide a very easy substitute for "parameterized unapply"...:D it is not a very flexible way of doing things though, maybe having full parameterized unapply is still desirable.
Burak  edited on  2007-07-06 12:20:26.0