From 5733fdbd3ed3e8036992ee690bbd8270a36471a2 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Sun, 7 Jun 2015 18:26:43 +0200 Subject: Fix mergeDenot one more time. It's easy to get this wrong. What happened was that when computing deferred members of a class a deferred member was preferred over a concrete one because the types did not match. Thsi should not happen. We now change the scheme to always prefer concrete over abstract, and subclass-owned over superclass-owned. But we pick a denotation only if the overrides relationship on types coincides with the preference on symbols. --- tests/disabled/t2503.scala | 19 ------------------- tests/disabled/t5577.scala | 27 --------------------------- tests/pos/t2503.scala | 19 +++++++++++++++++++ tests/pos/t5577.scala | 27 +++++++++++++++++++++++++++ 4 files changed, 46 insertions(+), 46 deletions(-) delete mode 100755 tests/disabled/t2503.scala delete mode 100644 tests/disabled/t5577.scala create mode 100755 tests/pos/t2503.scala create mode 100644 tests/pos/t5577.scala (limited to 'tests') diff --git a/tests/disabled/t2503.scala b/tests/disabled/t2503.scala deleted file mode 100755 index d0983f2ca..000000000 --- a/tests/disabled/t2503.scala +++ /dev/null @@ -1,19 +0,0 @@ -import scala.collection.mutable._ - -trait SB[A] extends Buffer[A] { - - import collection.Traversable - - abstract override def insertAll(n: Int, iter: Traversable[A]): Unit = synchronized { - super.insertAll(n, iter) - } - - abstract override def update(n: Int, newelem: A): Unit = synchronized { - super.update(n, newelem) - } -} - -object Test extends dotty.runtime.LegacyApp { - new ArrayBuffer[Int] with SB[Int] -} - diff --git a/tests/disabled/t5577.scala b/tests/disabled/t5577.scala deleted file mode 100644 index d54a37e45..000000000 --- a/tests/disabled/t5577.scala +++ /dev/null @@ -1,27 +0,0 @@ - - - -import collection._ - - - -object Test { - - class AlarmingBuffer[T] extends mutable.ArrayBuffer[T] { - override def sizeHint(x: Int): Unit = { - println("Received a size hint: " + x) - super.sizeHint(x) - } - } - - def main(args: Array[String]): Unit = { - val iteratorBuilder = (new AlarmingBuffer[Int]) mapResult { - res => res.iterator - } - - iteratorBuilder.sizeHint(10) - iteratorBuilder ++= (0 until 10) - iteratorBuilder.result.foreach(println) - } - -} diff --git a/tests/pos/t2503.scala b/tests/pos/t2503.scala new file mode 100755 index 000000000..d0983f2ca --- /dev/null +++ b/tests/pos/t2503.scala @@ -0,0 +1,19 @@ +import scala.collection.mutable._ + +trait SB[A] extends Buffer[A] { + + import collection.Traversable + + abstract override def insertAll(n: Int, iter: Traversable[A]): Unit = synchronized { + super.insertAll(n, iter) + } + + abstract override def update(n: Int, newelem: A): Unit = synchronized { + super.update(n, newelem) + } +} + +object Test extends dotty.runtime.LegacyApp { + new ArrayBuffer[Int] with SB[Int] +} + diff --git a/tests/pos/t5577.scala b/tests/pos/t5577.scala new file mode 100644 index 000000000..d54a37e45 --- /dev/null +++ b/tests/pos/t5577.scala @@ -0,0 +1,27 @@ + + + +import collection._ + + + +object Test { + + class AlarmingBuffer[T] extends mutable.ArrayBuffer[T] { + override def sizeHint(x: Int): Unit = { + println("Received a size hint: " + x) + super.sizeHint(x) + } + } + + def main(args: Array[String]): Unit = { + val iteratorBuilder = (new AlarmingBuffer[Int]) mapResult { + res => res.iterator + } + + iteratorBuilder.sizeHint(10) + iteratorBuilder ++= (0 until 10) + iteratorBuilder.result.foreach(println) + } + +} -- cgit v1.2.3