aboutsummaryrefslogtreecommitdiff
path: root/tests/pos/typers.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2013-12-24 11:59:34 +0100
committerMartin Odersky <odersky@gmail.com>2013-12-24 12:33:35 +0100
commitb23bc744ce9f8275fb6b433e40f14158eefc1abf (patch)
treecbeea6b180a011f05c169658f062dfc454eebb3f /tests/pos/typers.scala
parent336a1fc56074b58c54951a4a351d258f23999281 (diff)
downloaddotty-b23bc744ce9f8275fb6b433e40f14158eefc1abf.tar.gz
dotty-b23bc744ce9f8275fb6b433e40f14158eefc1abf.tar.bz2
dotty-b23bc744ce9f8275fb6b433e40f14158eefc1abf.zip
Fixing problems in treatment of private symbols
1) Accessibility check was broken because it looked at symbol's owner, where it should have looked at context owner. 2) Refined treatement if members. Previously, nonPrivate member returned a subset of member, i.e. those denotations returned by member that were not private. This is not correct. In a situation like class A { def x: Int = 1 } class B { private def x: String = "" } extends A (new B).x the non-private member returned should be A#x. Changed membersNamed and friends as well as checkAccessible to account for that.
Diffstat (limited to 'tests/pos/typers.scala')
-rw-r--r--tests/pos/typers.scala15
1 files changed, 15 insertions, 0 deletions
diff --git a/tests/pos/typers.scala b/tests/pos/typers.scala
index c3101ea2c..fd2cc9b74 100644
--- a/tests/pos/typers.scala
+++ b/tests/pos/typers.scala
@@ -63,5 +63,20 @@ object typers {
class Refinements {
val y: C { type T; val key: T; def process(x: T): Int }
}
+
+ object Accessibility {
+
+ class A {
+ val x: String = "abc"
+ }
+
+ class B extends A {
+ private def x: Int = 1
+ }
+
+ val b: B = new B
+ val y = b.x
+
+ }
} \ No newline at end of file