From 5ed834e251f2a83cadf19ae832268ead3e34de37 Mon Sep 17 00:00:00 2001 From: Luc Bourlier Date: Mon, 2 Dec 2013 15:25:08 +0100 Subject: SI-7995 completion imported vars and vals Imported member vals and vars were always marked inaccessible, even if referencing them at the location of the completion is valid in code. The accessible flag is now set accordingly to the accessibility of the getter. --- src/compiler/scala/tools/nsc/interactive/Global.scala | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'src/compiler') diff --git a/src/compiler/scala/tools/nsc/interactive/Global.scala b/src/compiler/scala/tools/nsc/interactive/Global.scala index 02a37ec217..a8d6f8977c 100644 --- a/src/compiler/scala/tools/nsc/interactive/Global.scala +++ b/src/compiler/scala/tools/nsc/interactive/Global.scala @@ -955,7 +955,11 @@ class Global(settings: Settings, _reporter: Reporter, projectName: String = "") val enclosing = new Members[ScopeMember] def addScopeMember(sym: Symbol, pre: Type, viaImport: Tree) = locals.add(sym, pre, false) { (s, st) => - new ScopeMember(s, st, context.isAccessible(s, pre, false), viaImport) + // imported val and var are always marked as inaccessible, but they could be accessed through their getters. SI-7995 + if (s.hasGetter) + new ScopeMember(s, st, context.isAccessible(s.getter, pre, superAccess = false), viaImport) + else + new ScopeMember(s, st, context.isAccessible(s, pre, superAccess = false), viaImport) } def localsToEnclosing() = { enclosing.addNonShadowed(locals) -- cgit v1.2.3