summaryrefslogtreecommitdiff
path: root/src/compiler/scala/tools/nsc/typechecker/Typers.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/Typers.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/Typers.scala')
-rw-r--r--src/compiler/scala/tools/nsc/typechecker/Typers.scala5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
index 2e1ed0863a..9f3f257529 100644
--- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala
+++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala
@@ -3946,7 +3946,8 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
* - simplest solution: have two method calls
*
*/
- def mkInvoke(cxTree: Tree, tree: Tree, qual: Tree, name: Name): Option[Tree] = {
+ def mkInvoke(context: Context, tree: Tree, qual: Tree, name: Name): Option[Tree] = {
+ val cxTree = context.enclosingNonImportContext.tree // SI-8364
debuglog(s"dyna.mkInvoke($cxTree, $tree, $qual, $name)")
val treeInfo.Applied(treeSelection, _, _) = tree
def isDesugaredApply = {
@@ -4608,7 +4609,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper
t
}
def typedSelectInternal(tree: Tree, qual: Tree, name: Name): Tree = {
- def asDynamicCall = dyna.mkInvoke(context.tree, tree, qual, name) map { t =>
+ def asDynamicCall = dyna.mkInvoke(context, tree, qual, name) map { t =>
dyna.wrapErrors(t, (_.typed1(t, mode, pt)))
}