aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorGuillaume Martres <smarter@ubuntu.com>2016-03-03 23:38:43 +0100
committerGuillaume Martres <smarter@ubuntu.com>2016-03-03 23:44:45 +0100
commit5225f00ab3300bac62a467ecc532c275e02e7f43 (patch)
tree7a4963de6b9d998f379fd0e00b6109f7bda464f3 /src
parent0ae3ef2010b90bf06d76a768b0f0c5aa56c1180a (diff)
downloaddotty-5225f00ab3300bac62a467ecc532c275e02e7f43.tar.gz
dotty-5225f00ab3300bac62a467ecc532c275e02e7f43.tar.bz2
dotty-5225f00ab3300bac62a467ecc532c275e02e7f43.zip
Do the implicit search shadowing check in the correct context
This commit fixes a very sneaky bug, the following code: ``` lazy val shadowing = typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto) (nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState) ``` is parsed by scalac as: ``` lazy val shadowing = typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto); (nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState); ``` So we don't actually use the nested context in `typed`, instead we end up implicitly using `ctx`!
Diffstat (limited to 'src')
-rw-r--r--src/dotty/tools/dotc/typer/Implicits.scala4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala
index e3dd113c2..5b336c2e9 100644
--- a/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/src/dotty/tools/dotc/typer/Implicits.scala
@@ -491,8 +491,8 @@ trait Implicits { self: Typer =>
pt)
val generated1 = adapt(generated, pt)
lazy val shadowing =
- typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)
- (nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState)
+ typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)(
+ nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState)
def refMatches(shadowing: Tree): Boolean =
ref.symbol == closureBody(shadowing).symbol || {
shadowing match {