diff options
author | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-11-19 10:13:09 -0800 |
---|---|---|
committer | Josh Suereth <Joshua.Suereth@gmail.com> | 2012-11-19 10:13:09 -0800 |
commit | 6cb08a1aabd915bbf3562c03d1b89af617eed81d (patch) | |
tree | 44c4218ab95893e41a46d42ca5fe9b85c79c185d /test/files/run | |
parent | 2d62ab248d07f10fd89a68b12565259ca861e1e9 (diff) | |
parent | 1f0e4880ad7ad816fd82c04f6814c5b165f86981 (diff) | |
download | scala-6cb08a1aabd915bbf3562c03d1b89af617eed81d.tar.gz scala-6cb08a1aabd915bbf3562c03d1b89af617eed81d.tar.bz2 scala-6cb08a1aabd915bbf3562c03d1b89af617eed81d.zip |
Merge pull request #1628 from axel22/issue/6150-backport
Fixes SI-6150 - backport to 2.10.x branch.
Diffstat (limited to 'test/files/run')
-rw-r--r-- | test/files/run/t6150.scala | 44 |
1 files changed, 44 insertions, 0 deletions
diff --git a/test/files/run/t6150.scala b/test/files/run/t6150.scala new file mode 100644 index 0000000000..bd8af5d460 --- /dev/null +++ b/test/files/run/t6150.scala @@ -0,0 +1,44 @@ + + + + +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]]] + + 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) + val iiv: immutable.IndexedSeq[Int] = immutable.Vector(1, 2, 3) + val iv: IndexedSeq[Int] = immutable.Vector(1, 2, 3) + + 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)) + } +} + + + + |