Skip to content

Commit 5225f00

Browse files
committed
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`!
1 parent 0ae3ef2 commit 5225f00

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/dotty/tools/dotc/typer/Implicits.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -491,8 +491,8 @@ trait Implicits { self: Typer =>
491491
pt)
492492
val generated1 = adapt(generated, pt)
493493
lazy val shadowing =
494-
typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)
495-
(nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState)
494+
typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)(
495+
nestedContext.addMode(Mode.ImplicitShadowing).setExploreTyperState)
496496
def refMatches(shadowing: Tree): Boolean =
497497
ref.symbol == closureBody(shadowing).symbol || {
498498
shadowing match {

0 commit comments

Comments
 (0)