From f7e5d9d0af7a5af7b7caabef75dcea0e2b27971e Mon Sep 17 00:00:00 2001 From: Iulian Dragos Date: Thu, 9 Nov 2006 16:06:18 +0000 Subject: Fixed bugs in protected accessors. --- test/files/jvm/protectedacc.check | 10 ++++---- test/files/jvm/protectedacc.scala | 51 +++++++++++++++++++++++++++++++++++---- 2 files changed, 51 insertions(+), 10 deletions(-) (limited to 'test/files/jvm') diff --git a/test/files/jvm/protectedacc.check b/test/files/jvm/protectedacc.check index ae0f39b997..2479af69c0 100644 --- a/test/files/jvm/protectedacc.check +++ b/test/files/jvm/protectedacc.check @@ -1,12 +1,12 @@ 10 meth1(1) = 2 -meth2(1)(1) = 2 -meth2(1)(1) = 2 +meth2(1)(1) = prefix: 0 +meth2(1)(1) = prefix: 0 meth3 = class [I -10++ = 11 +100 = 100 count before: 3 count after: 4 10 meth1(1) = 2 -meth2(1)(1) = 2 -10++ = 11 +meth2(1)(1) = 10 +100 = 100 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) + } + } + } } } -- cgit v1.2.3