summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
diff options
context:
space:
mode:
authorEugene Burmako <xeno.by@gmail.com>2014-03-06 13:41:02 +0100
committerEugene Burmako <xeno.by@gmail.com>2014-03-07 13:55:38 +0100
commiteb4a2e3343c9ee0ceaa249fc36b257dd6c13edf3 (patch)
treea0a36dc9289fae5f5b5955b905c44aae893ff7da /src/compiler/scala/tools/nsc/typechecker/Contexts.scala
parent2dddb03b267770afcd0249ad700e55d53019e637 (diff)
downloadscala-eb4a2e3343c9ee0ceaa249fc36b257dd6c13edf3.tar.gz
scala-eb4a2e3343c9ee0ceaa249fc36b257dd6c13edf3.tar.bz2
scala-eb4a2e3343c9ee0ceaa249fc36b257dd6c13edf3.zip
SI-8364 fixes cxTree lookup for imports
This is reminiscent of the bug that I recently fixed in paradise: https://github.com/scalamacros/paradise/commit/0dc4e35883d357b7cbcdfd83b5b4821c1dcc0bb1. When doing something non-standard with contexts, we usually have to keep in mind that new contexts are created not only for trees that demarcate blocks of code, but also for imports.
Diffstat (limited to 'src/compiler/scala/tools/nsc/typechecker/Contexts.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Contexts.scala7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
index 98ee4ad94d..133e80788b 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Contexts.scala
@@ -652,6 +652,13 @@ trait Contexts { self: Analyzer =>
c
}
+ def enclosingNonImportContext: Context = {
+ var c = this
+ while (c != NoContext && c.tree.isInstanceOf[Import])
+ c = c.outer
+ c
+ }
+
/** Is `sym` accessible as a member of `pre` in current context? */
def isAccessible(sym: Symbol, pre: Type, superAccess: Boolean = false): Boolean = {
lastAccessCheckDetails = ""