|
[#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] |