summaryrefslogtreecommitdiff
path: root/test/files/pos/t4365
diff options
context:
space:
mode:
authorPaul Phillips <paulp@improving.org>2013-04-22 07:59:26 -0700
committerPaul Phillips <paulp@improving.org>2013-04-22 09:26:08 -0700
commit7b4e450e9b746a9289f6d429cdee73bffa5cd733 (patch)
treec34f3dbe89eac6b3328eead8baf866d16b50c336 /test/files/pos/t4365
parent1d54f26b9a87c8df6a3b0e4472147d1ffb9037f1 (diff)
downloadscala-7b4e450e9b746a9289f6d429cdee73bffa5cd733.tar.gz
scala-7b4e450e9b746a9289f6d429cdee73bffa5cd733.tar.bz2
scala-7b4e450e9b746a9289f6d429cdee73bffa5cd733.zip
SI-4365 nondeterministic failure in asSeenFrom
Under some order-dependent conditions (if source files arrive in one order it happens, in the other order it does not) more than one set of type parameters are created for a given class. Previously this would lead to a crash in asSeenFrom when a type parameter had to be matched up with a type application. Now when that situation arises I compare them by name and log a dev warning if it hits. This does not risk anything undesirable happening because the wayward type parameter's owner is always the right class; it's only the class type parameters which don't include the wayward one. Since in a given type parameter list names are unique, we have enough information to salvage the search.
Diffstat (limited to 'test/files/pos/t4365')
-rw-r--r--test/files/pos/t4365/a_1.scala18
-rw-r--r--test/files/pos/t4365/b_1.scala22
2 files changed, 40 insertions, 0 deletions
diff --git a/test/files/pos/t4365/a_1.scala b/test/files/pos/t4365/a_1.scala
new file mode 100644
index 0000000000..6f3405b1ff
--- /dev/null
+++ b/test/files/pos/t4365/a_1.scala
@@ -0,0 +1,18 @@
+import scala.collection._
+
+trait SeqViewLike[+A,
+ +Coll,
+ +This <: SeqView[A, Coll] with SeqViewLike[A, Coll, This]]
+ extends Seq[A] with GenSeqViewLike[A, Coll, This]
+{
+
+ trait Transformed[+B] extends super[GenSeqViewLike].Transformed[B]
+
+ abstract class AbstractTransformed[+B] extends Seq[B] with Transformed[B] {
+ def underlying: Coll = error("")
+ }
+
+ trait Reversed extends Transformed[A] with super[GenSeqViewLike].Reversed
+
+ protected def newReversed: Transformed[A] = new AbstractTransformed[A] with Reversed
+}
diff --git a/test/files/pos/t4365/b_1.scala b/test/files/pos/t4365/b_1.scala
new file mode 100644
index 0000000000..e5b5687185
--- /dev/null
+++ b/test/files/pos/t4365/b_1.scala
@@ -0,0 +1,22 @@
+import scala.collection._
+
+trait GenSeqViewLike[+A,
+ +Coll,
+ +This <: GenSeqView[A, Coll] with GenSeqViewLike[A, Coll, This]]
+extends GenSeq[A] {
+self =>
+
+ trait Transformed[+B] {
+ def length: Int = 0
+ def apply(idx: Int): B = error("")
+ }
+
+ trait Reversed extends Transformed[A] {
+ def iterator: Iterator[A] = createReversedIterator
+
+ private def createReversedIterator: Iterator[A] = {
+ self.foreach(_ => ())
+ null
+ }
+ }
+}