From 47fad25adba895e8b27aee479373ea364dd316dd Mon Sep 17 00:00:00 2001 From: Paul Phillips Date: Tue, 19 Jun 2012 09:45:49 -0700 Subject: Fix for SI-5953, extension methods crasher. As usual, .tpe -> .tpeHK. As a side note following an old theme, if symbols of type parameters knew that they were symbols of type parameters, they could call tpeHK themselves rather than every call site having to do it. It's the operation which injects dummies which should require explicit programmer action, not the operation which faithfully reproduces the unapplied type. Were it that way, errors could be caught much more quickly via ill-kindedness. Seems like an improvement over lurking compiler crashes at every call to tparam.tpe. --- test/files/pos/t5953.scala | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/files/pos/t5953.scala (limited to 'test/files/pos/t5953.scala') diff --git a/test/files/pos/t5953.scala b/test/files/pos/t5953.scala new file mode 100644 index 0000000000..90e7d84646 --- /dev/null +++ b/test/files/pos/t5953.scala @@ -0,0 +1,16 @@ +import scala.collection.{ mutable, immutable, generic, GenTraversableOnce } + +package object foo { + @inline implicit class TravOps[A, CC[A] <: GenTraversableOnce[A]](val coll: CC[A]) extends AnyVal { + def build[CC2[X]](implicit cbf: generic.CanBuildFrom[Nothing, A, CC2[A]]): CC2[A] = { + cbf() ++= coll.toIterator result + } + } +} + +package foo { + object Test { + def f1[T](xs: Traversable[T]) = xs.convertTo[immutable.Vector] + def f2[T](xs: Traversable[T]) = xs.build[immutable.Vector] + } +} -- cgit v1.2.3