diff options
author | Paul Phillips <paulp@improving.org> | 2011-01-08 08:08:27 +0000 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-01-08 08:08:27 +0000 |
commit | d45b5ceed946dbcfb9a852cc7fd25267b6b168a2 (patch) | |
tree | 509d69ec309c6ec84e1e341de61390843a4d6ca8 | |
parent | 32e7c243272d7aaae6c662aa3e1716dae61e1117 (diff) | |
download | scala-d45b5ceed946dbcfb9a852cc7fd25267b6b168a2.tar.gz scala-d45b5ceed946dbcfb9a852cc7fd25267b6b168a2.tar.bz2 scala-d45b5ceed946dbcfb9a852cc7fd25267b6b168a2.zip |
Override checks and self-types still needed som...
Override checks and self-types still needed some work (ticket #2808.)
I believe this is the right change. The modifications in parallel and
actors were a result of the files failing to compile after the change to
allOverriddenSymbols. (I am taking the position that that aspect is a
feature.) Review by malayeri, odersky.
-rw-r--r-- | src/actors/scala/actors/AbstractActor.scala | 2 | ||||
-rw-r--r-- | src/actors/scala/actors/ReactorCanReply.scala | 2 | ||||
-rw-r--r-- | src/actors/scala/actors/remote/Proxy.scala | 2 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/symtab/Symbols.scala | 2 | ||||
-rw-r--r-- | src/library/scala/collection/parallel/Combiner.scala | 7 | ||||
-rw-r--r-- | test/files/pos/self-type-override.scala | 13 |
6 files changed, 24 insertions, 4 deletions
diff --git a/src/actors/scala/actors/AbstractActor.scala b/src/actors/scala/actors/AbstractActor.scala index c25e785d76..dc7ac4cca8 100644 --- a/src/actors/scala/actors/AbstractActor.scala +++ b/src/actors/scala/actors/AbstractActor.scala @@ -18,7 +18,7 @@ package scala.actors */ trait AbstractActor extends OutputChannel[Any] with CanReply[Any, Any] { - type Future[+R] = scala.actors.Future[R] + type Future[+R] <: scala.actors.Future[R] private[actors] def exiting: Boolean = false diff --git a/src/actors/scala/actors/ReactorCanReply.scala b/src/actors/scala/actors/ReactorCanReply.scala index 884c0ceecc..f94115c491 100644 --- a/src/actors/scala/actors/ReactorCanReply.scala +++ b/src/actors/scala/actors/ReactorCanReply.scala @@ -18,7 +18,7 @@ package scala.actors private[actors] trait ReactorCanReply extends CanReply[Any, Any] { _: ReplyReactor => - override type Future[+P] = scala.actors.Future[P] + type Future[+P] = scala.actors.Future[P] def !?(msg: Any): Any = (this !! msg)() diff --git a/src/actors/scala/actors/remote/Proxy.scala b/src/actors/scala/actors/remote/Proxy.scala index 8df723adee..766f31fc6f 100644 --- a/src/actors/scala/actors/remote/Proxy.scala +++ b/src/actors/scala/actors/remote/Proxy.scala @@ -18,6 +18,8 @@ import scala.collection.mutable.HashMap private[remote] class Proxy(node: Node, name: Symbol, @transient var kernel: NetKernel) extends AbstractActor with Serializable { import java.io.{IOException, ObjectOutputStream, ObjectInputStream} + type Future[+P] = scala.actors.Future[P] + @transient private[remote] var del: Actor = null startDelegate() diff --git a/src/compiler/scala/tools/nsc/symtab/Symbols.scala b/src/compiler/scala/tools/nsc/symtab/Symbols.scala index 4eae44c1d0..c269472aa3 100644 --- a/src/compiler/scala/tools/nsc/symtab/Symbols.scala +++ b/src/compiler/scala/tools/nsc/symtab/Symbols.scala @@ -1382,7 +1382,7 @@ trait Symbols extends reflect.generic.Symbols { self: SymbolTable => final def allOverriddenSymbols: List[Symbol] = if (!owner.isClass) Nil - else owner.ancestors map overriddenSymbol filter (_ != NoSymbol) + else owner.thisSym.ancestors map overriddenSymbol filter (_ != NoSymbol) /** The symbol accessed by a super in the definition of this symbol when * seen from class `base'. This symbol is always concrete. diff --git a/src/library/scala/collection/parallel/Combiner.scala b/src/library/scala/collection/parallel/Combiner.scala index 7b133cdbba..4a6ae0cd8f 100644 --- a/src/library/scala/collection/parallel/Combiner.scala +++ b/src/library/scala/collection/parallel/Combiner.scala @@ -22,7 +22,12 @@ trait Combiner[-Elem, +To] extends Builder[Elem, To] with Sizing with Parallel { self: EnvironmentPassingCombiner[Elem, To] => private[collection] final val tasksupport = getTaskSupport - type EPC = EnvironmentPassingCombiner[Elem, To] + // type EPC = EnvironmentPassingCombiner[Elem, To] + // + // [scalacfork] /scratch/trunk2/src/library/scala/collection/parallel/Combiner.scala:25: error: contravariant type Elem occurs in invariant position in type scala.collection.parallel.EnvironmentPassingCombiner[Elem,To] of type EPC + // [scalacfork] type EPC = EnvironmentPassingCombiner[Elem, To] + // [scalacfork] ^ + // [scalacfork] one error found /** Combines the contents of the receiver builder and the `other` builder, * producing a new builder containing both their elements. diff --git a/test/files/pos/self-type-override.scala b/test/files/pos/self-type-override.scala new file mode 100644 index 0000000000..7c40ef37e6 --- /dev/null +++ b/test/files/pos/self-type-override.scala @@ -0,0 +1,13 @@ +trait TCommon { + def f: String +} + +class C1 extends TCommon { + def f = "in C1" +} + +trait TOverrider { this: TCommon => + override def f = "in TOverrider" // The overridden self-type member... +} + +class C2 extends C1 with TOverrider // ... fails to override, here. |