summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/interactive/Global.scala
diff options
context:
space:
mode:
authorLuc Bourlier <luc.bourlier@typesafe.com>2013-12-02 15:25:08 +0100
committerLuc Bourlier <luc.bourlier@typesafe.com>2013-12-06 13:56:46 +0100
commit5ed834e251f2a83cadf19ae832268ead3e34de37 (patch)
tree3190ca5ed683f9d58ff2891d3fc069204437a6dd /src/compiler/scala/tools/nsc/interactive/Global.scala
parent7c1d1149291e1b83c96a0f6954144b9e97c030ea (diff)
downloadscala-5ed834e251f2a83cadf19ae832268ead3e34de37.tar.gz
scala-5ed834e251f2a83cadf19ae832268ead3e34de37.tar.bz2
scala-5ed834e251f2a83cadf19ae832268ead3e34de37.zip
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.
Diffstat (limited to 'src/compiler/scala/tools/nsc/interactive/Global.scala')
-rw-r--r--src/compiler/scala/tools/nsc/interactive/Global.scala6
1 files changed, 5 insertions, 1 deletions
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)