summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2004-01-12 10:56:44 +0000
committerMartin Odersky <odersky@gmail.com>2004-01-12 10:56:44 +0000
commit5665f6b29c900fbfeee2f8f45752bc74947093d7 (patch)
tree16754135e12c6d8ac32d941dfb45cc80cf4c40e0
parent8698d99b934a7982353db3632abfc54d0acb80f3 (diff)
downloadscala-5665f6b29c900fbfeee2f8f45752bc74947093d7.tar.gz
scala-5665f6b29c900fbfeee2f8f45752bc74947093d7.tar.bz2
scala-5665f6b29c900fbfeee2f8f45752bc74947093d7.zip
*** empty log message ***
-rw-r--r--doc/reference/ScalaByExample.tex20
-rw-r--r--sources/scala/concurrent/Actor.scala19
-rw-r--r--sources/scala/concurrent/MailBox.scala2
-rw-r--r--test/files/neg/S4.check2
-rw-r--r--test/files/neg/bug152.check2
-rw-r--r--test/files/neg/bug58.check2
-rw-r--r--test/files/neg/bug95.check10
-rw-r--r--test/files/neg/constrparams.check2
-rw-r--r--test/neg/S4.check2
-rw-r--r--test/neg/bug152.check2
-rw-r--r--test/neg/bug58.check2
-rw-r--r--test/neg/bug95.check10
-rw-r--r--test/neg/constrparams.check2
13 files changed, 31 insertions, 46 deletions
diff --git a/doc/reference/ScalaByExample.tex b/doc/reference/ScalaByExample.tex
index 786d83611d..baf099238d 100644
--- a/doc/reference/ScalaByExample.tex
+++ b/doc/reference/ScalaByExample.tex
@@ -6714,24 +6714,10 @@ implementation of an electronic auction service. This service was
based on high-level actor processes, that work by inspecting messages
in their mailbox using pattern matching. An actor is simply a thread
whose communication primitives are those of a mailbox. Actors are
-defined as an extension of Java's standard \code{Thread} class which
-forwards all communication calls to an internal mailbox.
+hence defined as a mixin composition extension of Java's standard
+\code{Thread} class with the \code{MailBox} class.
\begin{lstlisting}
-abstract class Actor extends Thread {
-
- type Message = AnyRef;
-
- private val mb = new MailBox;
-
- def send(msg: Message): unit =
- mb.send(msg);
-
- def receive[a](f: PartialFunction[Message, a]): a =
- mb.receive(f);
-
- def receiveWithin[a](msec: long)(f: PartialFunction[Message, a]): a =
- mb.receiveWithin(msec)(f);
-}
+abstract class Actor extends Thread with MailBox;
\end{lstlisting}
\comment{
diff --git a/sources/scala/concurrent/Actor.scala b/sources/scala/concurrent/Actor.scala
index dd4cee26d2..0e8caa4b7f 100644
--- a/sources/scala/concurrent/Actor.scala
+++ b/sources/scala/concurrent/Actor.scala
@@ -1,22 +1,5 @@
package scala.concurrent;
-abstract class Actor extends Thread() {
-
- type Message = AnyRef;
-
- private val mb = new MailBox;
-
- def send(msg: Message): unit =
- mb.send(msg);
-
- def receive[a](f: PartialFunction[Message, a]): a =
- mb.receive(f);
-
- def receiveWithin[a](msec: long)(f: PartialFunction[Message, a]): a =
- mb.receiveWithin(msec)(f);
-}
-
-
-
+abstract class Actor extends Thread with MailBox;
diff --git a/sources/scala/concurrent/MailBox.scala b/sources/scala/concurrent/MailBox.scala
index f173a2912f..d8c59c774b 100644
--- a/sources/scala/concurrent/MailBox.scala
+++ b/sources/scala/concurrent/MailBox.scala
@@ -1,7 +1,7 @@
package scala.concurrent;
//class MailBox with Monitor with LinkedListQueueCreator {
-class MailBox extends Monitor with ListQueueCreator {
+class MailBox with Monitor with ListQueueCreator {
type Message = AnyRef;
diff --git a/test/files/neg/S4.check b/test/files/neg/S4.check
index 1297b6d18c..c8de54cd39 100644
--- a/test/files/neg/S4.check
+++ b/test/files/neg/S4.check
@@ -1,4 +1,4 @@
-S4.scala:4: type a.type escapes its defining scope as part of a.Inner { def foo(a.Inner): a.Inner, val b$: Other, def b: Other }
+S4.scala:4: type a.type escapes its defining scope as part of a.Inner with scala.ScalaObject { def foo(a.Inner): a.Inner, val b$: Other, def b: Other }
class S4(a: Other) extends a.Inner() {
^
one error found
diff --git a/test/files/neg/bug152.check b/test/files/neg/bug152.check
index fddfbfa879..7b1f3262ce 100644
--- a/test/files/neg/bug152.check
+++ b/test/files/neg/bug152.check
@@ -1,4 +1,4 @@
-bug152.scala:5: type foo.type escapes its defining scope as part of scala.Object { def a: foo.T }
+bug152.scala:5: type foo.type escapes its defining scope as part of java.lang.Object with scala.ScalaObject { def a: foo.T }
class Bar(foo: Foo) {
^
one error found
diff --git a/test/files/neg/bug58.check b/test/files/neg/bug58.check
index 1872ecd0d9..0dff5495cf 100644
--- a/test/files/neg/bug58.check
+++ b/test/files/neg/bug58.check
@@ -1,4 +1,4 @@
-bug58.scala:1: type x.type escapes its defining scope as part of x.C
+bug58.scala:1: type x.type escapes its defining scope as part of x.C with scala.ScalaObject
class A(x: B) extends x.C {}
^
one error found
diff --git a/test/files/neg/bug95.check b/test/files/neg/bug95.check
index 0f67daa2fe..8dd3507cd9 100644
--- a/test/files/neg/bug95.check
+++ b/test/files/neg/bug95.check
@@ -1,7 +1,15 @@
bug95.scala:1: illegal inheritance from sealed class
class C extends AnyVal;
^
+bug95.scala:1: illegal inheritance;
+ scala.AnyVal does not conform to scala.ScalaObject's supertype
+class C extends AnyVal;
+ ^
bug95.scala:2: illegal inheritance from sealed class
class T extends Unit;
^
-two errors found
+bug95.scala:2: illegal inheritance;
+ scala.Unit does not conform to scala.ScalaObject's supertype
+class T extends Unit;
+ ^
+four errors found
diff --git a/test/files/neg/constrparams.check b/test/files/neg/constrparams.check
index a9b7c39573..6aef035af0 100644
--- a/test/files/neg/constrparams.check
+++ b/test/files/neg/constrparams.check
@@ -3,7 +3,7 @@ constrparams.scala:4: type mismatch;
required: x.t
private val z: x.t = null; //error
^
-constrparams.scala:1: type x.type escapes its defining scope as part of scala.Object { type t, val y$: x.type, def y: x.type, val z$: x.t, def z: x.t }
+constrparams.scala:1: type x.type escapes its defining scope as part of java.lang.Object with scala.ScalaObject { type t, val y$: x.type, def y: x.type, val z$: x.t, def z: x.t }
abstract class C(x: C) {
^
two errors found
diff --git a/test/neg/S4.check b/test/neg/S4.check
index 1297b6d18c..c8de54cd39 100644
--- a/test/neg/S4.check
+++ b/test/neg/S4.check
@@ -1,4 +1,4 @@
-S4.scala:4: type a.type escapes its defining scope as part of a.Inner { def foo(a.Inner): a.Inner, val b$: Other, def b: Other }
+S4.scala:4: type a.type escapes its defining scope as part of a.Inner with scala.ScalaObject { def foo(a.Inner): a.Inner, val b$: Other, def b: Other }
class S4(a: Other) extends a.Inner() {
^
one error found
diff --git a/test/neg/bug152.check b/test/neg/bug152.check
index fddfbfa879..7b1f3262ce 100644
--- a/test/neg/bug152.check
+++ b/test/neg/bug152.check
@@ -1,4 +1,4 @@
-bug152.scala:5: type foo.type escapes its defining scope as part of scala.Object { def a: foo.T }
+bug152.scala:5: type foo.type escapes its defining scope as part of java.lang.Object with scala.ScalaObject { def a: foo.T }
class Bar(foo: Foo) {
^
one error found
diff --git a/test/neg/bug58.check b/test/neg/bug58.check
index 1872ecd0d9..0dff5495cf 100644
--- a/test/neg/bug58.check
+++ b/test/neg/bug58.check
@@ -1,4 +1,4 @@
-bug58.scala:1: type x.type escapes its defining scope as part of x.C
+bug58.scala:1: type x.type escapes its defining scope as part of x.C with scala.ScalaObject
class A(x: B) extends x.C {}
^
one error found
diff --git a/test/neg/bug95.check b/test/neg/bug95.check
index 0f67daa2fe..8dd3507cd9 100644
--- a/test/neg/bug95.check
+++ b/test/neg/bug95.check
@@ -1,7 +1,15 @@
bug95.scala:1: illegal inheritance from sealed class
class C extends AnyVal;
^
+bug95.scala:1: illegal inheritance;
+ scala.AnyVal does not conform to scala.ScalaObject's supertype
+class C extends AnyVal;
+ ^
bug95.scala:2: illegal inheritance from sealed class
class T extends Unit;
^
-two errors found
+bug95.scala:2: illegal inheritance;
+ scala.Unit does not conform to scala.ScalaObject's supertype
+class T extends Unit;
+ ^
+four errors found
diff --git a/test/neg/constrparams.check b/test/neg/constrparams.check
index a9b7c39573..6aef035af0 100644
--- a/test/neg/constrparams.check
+++ b/test/neg/constrparams.check
@@ -3,7 +3,7 @@ constrparams.scala:4: type mismatch;
required: x.t
private val z: x.t = null; //error
^
-constrparams.scala:1: type x.type escapes its defining scope as part of scala.Object { type t, val y$: x.type, def y: x.type, val z$: x.t, def z: x.t }
+constrparams.scala:1: type x.type escapes its defining scope as part of java.lang.Object with scala.ScalaObject { type t, val y$: x.type, def y: x.type, val z$: x.t, def z: x.t }
abstract class C(x: C) {
^
two errors found