From b23bc744ce9f8275fb6b433e40f14158eefc1abf Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 24 Dec 2013 11:59:34 +0100 Subject: 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. --- tests/pos/typers.scala | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'tests/pos/typers.scala') 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 -- cgit v1.2.3