summaryrefslogtreecommitdiff
path: root/test/files/pos/gosh.scala
diff options
context:
space:
mode:
authorBurak Emir <emir@epfl.ch>2007-01-24 15:20:25 +0000
committerBurak Emir <emir@epfl.ch>2007-01-24 15:20:25 +0000
commit0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192 (patch)
tree0bb95122566e05dcc1f81322f3a3740d2e1a81cd /test/files/pos/gosh.scala
parent1cbef2171c91fd0e001b4d0c1570c07017877044 (diff)
downloadscala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.tar.gz
scala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.tar.bz2
scala-0ef0f40ae31bf8a1e3d5b9c6eea7ef5b5a073192.zip
moved working tests to files
Diffstat (limited to 'test/files/pos/gosh.scala')
-rw-r--r--test/files/pos/gosh.scala44
1 files changed, 44 insertions, 0 deletions
diff --git a/test/files/pos/gosh.scala b/test/files/pos/gosh.scala
new file mode 100644
index 0000000000..c4cd3df80b
--- /dev/null
+++ b/test/files/pos/gosh.scala
@@ -0,0 +1,44 @@
+object ShapeTest extends Application {
+
+ class Point(x : int, y : int) {
+ override def toString() = "[" + x + "," + y + "]"
+ }
+
+ abstract class Shape {
+ def draw() : unit
+ }
+
+ class Line(s : Point, e : Point) extends Shape {
+ def draw() : unit = { Console.println("draw line " + s + "," + e) }
+ }
+
+ abstract class Foo {
+ type T <: Object
+
+ def show(o : T) : unit
+ def print() : unit = {Console.println("in Foo")}
+ }
+
+ abstract class ShapeFoo extends Foo {
+ type T <: Shape
+ def show(o : T) : unit = { o.draw() }
+ override def print() : unit = {Console.println("in ShapeFoo")}
+ }
+
+ class LineFoo extends ShapeFoo {
+ type T = Line
+ override def print() : unit = {Console.println("in LineFoo")}
+ }
+
+ val p1 = new Point(1,4)
+ val p2 = new Point(12, 28)
+
+ val l1 = new Line(p1, p2)
+
+
+ val l = new ShapeFoo{ // ** //
+ type T = Line // ** //
+ override def print() : unit = {Console.println("in LineFoo")} // ** //
+ }
+ l.show(l1) // ** //
+}