summaryrefslogtreecommitdiff
path: root/test/files/jvm/protectedacc.scala
diff options
context:
space:
mode:
authorIulian Dragos <jaguarul@gmail.com>2006-11-09 16:06:18 +0000
committerIulian Dragos <jaguarul@gmail.com>2006-11-09 16:06:18 +0000
commitf7e5d9d0af7a5af7b7caabef75dcea0e2b27971e (patch)
treecf0ae0265d87016c5e3c590651990ab67ccc3303 /test/files/jvm/protectedacc.scala
parentaa93e6f3b8686f20e6d16e177e5ec1e24d588096 (diff)
downloadscala-f7e5d9d0af7a5af7b7caabef75dcea0e2b27971e.tar.gz
scala-f7e5d9d0af7a5af7b7caabef75dcea0e2b27971e.tar.bz2
scala-f7e5d9d0af7a5af7b7caabef75dcea0e2b27971e.zip
Fixed bugs in protected accessors.
Diffstat (limited to 'test/files/jvm/protectedacc.scala')
-rw-r--r--test/files/jvm/protectedacc.scala51
1 files changed, 46 insertions, 5 deletions
diff --git a/test/files/jvm/protectedacc.scala b/test/files/jvm/protectedacc.scala
index a6bc8984c4..0fda40babe 100644
--- a/test/files/jvm/protectedacc.scala
+++ b/test/files/jvm/protectedacc.scala
@@ -29,11 +29,30 @@ package p {
protected val x = 10;
protected def meth1(x: Int) = x + 1;
- protected def meth2(x: Int)(y: Int) = x + y;
+ protected def meth2(x: Int)(y: String) = y + (x - 1);
protected def meth3 = Array(1, 2)
def getA: this.type = this;
}
+
+ /** Test type members */
+ trait HighlighterXXX {
+ type Node;
+ protected def highlight(node : Node) : Unit;
+ }
+
+ /** Test type parameters */
+ abstract class PolyA[a] {
+ protected def m(x: a): Unit;
+
+ class B {
+
+ trait Node {
+ def s: String = "";
+ }
+ protected def tie(x: Node): Unit = { x.s; () }
+ }
+ }
}
package b {
@@ -47,12 +66,12 @@ package p {
Console.println("meth1(1) = " + meth1(1));
// test accesses from closures
for (val x <- 1 until 3)
- Console.println("meth2(1)(1) = " + meth2(1)(1));
+ Console.println("meth2(1)(1) = " + meth2(1)("prefix: "));
Console.println("meth3 = " + meth3.getClass);
val inc = &meth2(1);
- Console.println("10++ = " + inc(10));
+ Console.println("100 = " + inc("10"));
getA.x;
}
@@ -76,14 +95,36 @@ package p {
def m = {
Console.println(x);
Console.println("meth1(1) = " + meth1(1));
- Console.println("meth2(1)(1) = " + meth2(1)(1));
+ Console.println("meth2(1)(1) = " + meth2(1)("1"));
val inc = &meth2(1);
- Console.println("10++ = " + inc(10));
+ Console.println("100 = " + inc("10"));
getA.x;
}
}
}
+
+ trait ScalaAutoEditXXX extends HighlighterXXX {
+ trait NodeImpl {
+ def self : Node;
+ highlight(self);
+ }
+ }
+
+ abstract class X[T] extends PolyA[T] {
+
+ trait Inner extends B {
+ def self: T;
+ def self2: Node;
+ def getB: Inner;
+
+ m(self)
+
+ trait InnerInner {
+ getB.tie(self2)
+ }
+ }
+ }
}
}