Scala IDE showing error on valid code
I get an error at line 8 in the following code, on the final unzip. The same code compiles fine in SBT 2.8.1 and 2.9.0-SNAPSHOT.
"type mismatch; found : unchecked required: scala.annotation.Annotation"
package sample
object Sample {
case class Tree[+A](val value: A, val children: Traversable[Tree[A]] = Seq.empty)
def unzip[A, B](tree: Tree[(A, B)]): (Tree[A], Tree[B]) = {
tree match {
case Tree((valA, valB), children) => {
val (childAs, childBs) = children.map(unzip(_)).unzip //<== Here
(Tree(valA, childAs), Tree(valB, childBs))
}}
}
}
"type mismatch; found : unchecked required: scala.annotation.Annotation"
package sample
object Sample {
case class Tree[+A](val value: A, val children: Traversable[Tree[A]] = Seq.empty)
def unzip[A, B](tree: Tree[(A, B)]): (Tree[A], Tree[B]) = {
tree match {
case Tree((valA, valB), children) => {
val (childAs, childBs) = children.map(unzip(_)).unzip //<== Here
(Tree(valA, childAs), Tree(valB, childBs))
}}
}
}
Leave a comment
on 2011-03-09 15:33 *
By eugene.vigdorchik
Ben,
I cannot reproduce the bug with your sample. Is it intermittent, or the error stays if you type space in the code?
I cannot reproduce the bug with your sample. Is it intermittent, or the error stays if you type space in the code?
on 2011-03-09 17:47 *
By David Bernard
I can not reproduce on wip_exp_backport.
Updating tickets (#1000199, #1000200, #1000201, #1000204, #1000205, #1000209, #1000210, #1000211, #1000212, #1000215, #1000217, #1000218, #1000220, #1000222, #1000226, #1000227, #1000228, #1000230, #1000231, #1000232, #1000233, #1000235, #1000236, #1000237, #1000239, #1000240, #1000241, #1000242, #1000243, #1000244, #1000248, #1000249, #1000252, #1000253, #1000254, #1000255, #1000256, #1000258, #1000259, #1000032, #1000059, #1000062, #1000163, #1000197, #1000216, #1000221, #1000224, #1000121, #1000175, #1000219, #1000251, #1000069, #1000195, #1000213, #1000223, #1000006, #1000021, #1000038, #1000048, #1000051, #1000052, #1000075, #1000103, #1000109, #1000115, #1000119, #1000156, #1000186, #1000207, #1000238, #1000262, #1000263, #380, #389, #683, #1238, #1331, #1635, #1645, #1715, #1729, #1744, #1783, #1839, #1869, #1885, #1890, #1902, #1918, #1919, #1924, #1925, #1946, #1964, #1991, #2131, #2233, #2342, #2348, #2408)
Seems to work fine in the current nightly
on 2011-03-25 00:42 *
By MattRussell
I had a similar issue with Scalariform on wip_experiment with m2eclipse -- the chief culprit was the pom.xml was bringing in a 2.8.0 Scala library onto the classpath. After disabling Maven dependency management and a clean + build, no compile errors remain.
on 2011-03-25 02:19 *
By David Bernard
Do you have m2eclipse-scala plugin ?
It should prevent to have scala-library into the Maven Dependency container.
It should prevent to have scala-library into the Maven Dependency container.
on 2011-04-02 17:15 *
By brhutchison
Big thanks to Matt Russell for the clue to solving this.
I did indeed have a 2nd, 2.8.1 copy of Scala & compiler libs in my claspath. In my case, added not by m2eclipse but by SBT (Eclipsify plugin, perhaps?). Removing them resolved the error. All good.
I did indeed have a 2nd, 2.8.1 copy of Scala & compiler libs in my claspath. In my case, added not by m2eclipse but by SBT (Eclipsify plugin, perhaps?). Removing them resolved the error. All good.