diff options
author | Paul Phillips <paulp@improving.org> | 2012-06-19 09:45:49 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-06-19 09:52:42 -0700 |
commit | 47fad25adba895e8b27aee479373ea364dd316dd (patch) | |
tree | fa23f2f7675bc48b3d89a70e1996a9c079783ca7 /test/files/pos | |
parent | 32d42b1264bd52578957abffe312a128ac23122b (diff) | |
download | scala-47fad25adba895e8b27aee479373ea364dd316dd.tar.gz scala-47fad25adba895e8b27aee479373ea364dd316dd.tar.bz2 scala-47fad25adba895e8b27aee479373ea364dd316dd.zip |
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.
Diffstat (limited to 'test/files/pos')
-rw-r--r-- | test/files/pos/t5953.scala | 16 |
1 files changed, 16 insertions, 0 deletions
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] + } +} |