summaryrefslogtreecommitdiff
path: root/test/files/run/t6150.scala
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2012-08-16 16:46:15 -0700
committerPaul Phillips <paulp@improving.org>2012-08-16 16:46:42 -0700
commit0fc0038e33b629efcaa0aa314b0e69419c116777 (patch)
tree51ea2b053fac4495305c92e5d34677a3563af471 /test/files/run/t6150.scala
parent0308ae88026a4a8d427d1a9156c31c0ff8dd2561 (diff)
downloadscala-0fc0038e33b629efcaa0aa314b0e69419c116777.tar.gz
scala-0fc0038e33b629efcaa0aa314b0e69419c116777.tar.bz2
scala-0fc0038e33b629efcaa0aa314b0e69419c116777.zip
Modified SI-6150 fix to use intended ReusableCBF.
I also realized it didn't have to be lazy, and made it so.
Diffstat (limited to 'test/files/run/t6150.scala')
-rw-r--r--test/files/run/t6150.scala48
1 files changed, 25 insertions, 23 deletions
diff --git a/test/files/run/t6150.scala b/test/files/run/t6150.scala
index 1b3de0c50a..f3e83e1549 100644
--- a/test/files/run/t6150.scala
+++ b/test/files/run/t6150.scala
@@ -1,34 +1,36 @@
+object Test {
+ import collection.{ immutable, mutable, generic }
+ def TheOneTrueCBF = collection.IndexedSeq.ReusableCBF
+ val cbf1 = implicitly[generic.CanBuildFrom[immutable.Vector[Int], Int, collection.IndexedSeq[Int]]]
+ val cbf2 = implicitly[generic.CanBuildFrom[immutable.IndexedSeq[Int], Int, collection.IndexedSeq[Int]]]
+ val cbf3 = implicitly[generic.CanBuildFrom[collection.IndexedSeq[Int], Int, collection.IndexedSeq[Int]]]
+ val cbf4 = implicitly[generic.CanBuildFrom[immutable.Vector[Int], Int, immutable.IndexedSeq[Int]]]
+ val cbf5 = implicitly[generic.CanBuildFrom[immutable.Vector[Int], Int, immutable.Vector[Int]]]
+ val cbf6 = implicitly[generic.CanBuildFrom[immutable.IndexedSeq[Int], Int, immutable.IndexedSeq[Int]]]
-import collection._
-
-
-
-object Test extends App {
-
- val cbf1 = implicitly[generic.CanBuildFrom[Vector[Int], Int, IndexedSeq[Int]]]
- val cbf2 = implicitly[generic.CanBuildFrom[immutable.IndexedSeq[Int], Int, IndexedSeq[Int]]]
- val cbf3 = implicitly[generic.CanBuildFrom[IndexedSeq[Int], Int, IndexedSeq[Int]]]
-
def check[C](v: C) = {
assert(v == Vector(1, 2, 3, 4))
assert(v.isInstanceOf[Vector[_]])
}
-
+ def checkRealMccoy(x: AnyRef) = {
+ assert(x eq TheOneTrueCBF, cbf1)
+ }
+
val v = immutable.Vector(1, 2, 3)
-
- check(v.:+(4)(cbf1))
- check(v.:+(4)(cbf2))
- check(v.:+(4)(cbf3))
-
val iiv: immutable.IndexedSeq[Int] = immutable.Vector(1, 2, 3)
-
- check(iiv.:+(4)(cbf2))
- check(iiv.:+(4)(cbf3))
-
val iv: IndexedSeq[Int] = immutable.Vector(1, 2, 3)
-
- check(iv.:+(4)(cbf3))
-
+
+ def main(args: Array[String]): Unit = {
+ List(cbf1, cbf2, cbf3, cbf4, cbf5, cbf6) foreach checkRealMccoy
+ check(v.:+(4)(cbf1))
+ check(v.:+(4)(cbf2))
+ check(v.:+(4)(cbf3))
+
+ check(iiv.:+(4)(cbf2))
+ check(iiv.:+(4)(cbf3))
+
+ check(iv.:+(4)(cbf3))
+ }
}