This appears to be a change in behaviour between 2.10.x and 2.11.0-SNAPSHOT,
Welcome to Scala version 2.11.0-20130116-203322-1dc6a99edc (Java
HotSpot(TM) 64-Bit Server VM, Java 1.7.0_05).
Type in expressions to have them evaluated.
Type :help for more information.
scala> import scala.collection.generic.CanBuildFrom
import scala.collection.generic.CanBuildFrom
scala> implicitly[CanBuildFrom[Nothing, Nothing, Array[Nothing]]]
<console>:9: error: Cannot construct a collection of type
Array[Nothing] with elements of type Nothing based on a collection of
type Nothing.
implicitly[CanBuildFrom[Nothing, Nothing, Array[Nothing]]]
The issue here is the lack of consistency between Array and non-array
collection types,
scala> List[Nothing]()
res0: List[Nothing] = List()
scala> new Array[Nothing](0)
res1: Array[Nothing] = Array()
scala> val cbf1 = implicitly[CanBuildFrom[Nothing, Nothing, List[Nothing]]]
cbf1: scala.collection.generic.CanBuildFrom[Nothing,Nothing,List[Nothing]]
= scala.collection.generic.GenTraversableFactory$$anon$1@61bb1e36
scala> cbf1().result
res2: List[Nothing] = List()
scala> val cbf2 = implicitly[CanBuildFrom[Nothing, Nothing, Array[Nothing]]]
<console>:8: error: Cannot construct a collection of type
Array[Nothing] with elements of type Nothing based on a collection of
type Nothing.
val cbf2 = implicitly[CanBuildFrom[Nothing, Nothing, Array[Nothing]]]
Intentional change? Regression?
Cheers,
Miles
--
Miles Sabin
tel:
+44 7813 944 528
skype: milessabin
gtalk:
mi...@milessabin.com
g+:
http://www.milessabin.com
http://twitter.com/milessabin