Aladdin - Scala Bugtracking
[#986] project: compiler priority: low category: bug
submitter assigned to status date submitted
Nikolay Martin fixed 2007-03-12 08:49:05.0
subject [contrib #361] Seq patterns give members the wrong type
code
List(2) match { case Seq(a) => a + a }
what happened
:4: error: value + is not a member of scala.Nothing
  val line0 = List(2) match { case Seq(a) => a + a }
what expected line0: scala.Int = 4 Scala 2.3.1 gives the correct answer. Also, here is a fun trick (not): scala> def cast[A,B](a : A) = List(a) match { case Seq(b) => b : B } cast: [A,B](A)B
[back to overview]
Changes of this bug report
Nikolay  edited on  2007-03-12 08:50:11.0
contribution #361
Burak  edited on  2007-03-12 09:51:43.0
Just for info, this is the same as #910
Martin  edited on  2007-03-12 16:38:37.0