Skip to content

Commit 742ae75

Browse files
committed
Merge pull request #1142 from dotty-staging/fix/implicit-ctx
Do the implicit search shadowing check in the correct context
2 parents e5c5948 + 42f87c2 commit 742ae75

File tree

2 files changed

+4
-6
lines changed

2 files changed

+4
-6
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 {

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

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -320,10 +320,8 @@ object ProtoTypes {
320320
*/
321321
def constrained(pt: PolyType, owningTree: untpd.Tree)(implicit ctx: Context): (PolyType, List[TypeVar]) = {
322322
val state = ctx.typerState
323-
def howmany = if (owningTree.isEmpty) "no" else "some"
324-
def committable = if (ctx.typerState.isCommittable) "committable" else "uncommittable"
325-
assert(owningTree.isEmpty != ctx.typerState.isCommittable,
326-
s"inconsistent: $howmany typevars were added to $committable constraint ${state.constraint}")
323+
assert(!(ctx.typerState.isCommittable && owningTree.isEmpty),
324+
s"inconsistent: no typevars were added to committable constraint ${state.constraint}")
327325

328326
def newTypeVars(pt: PolyType): List[TypeVar] =
329327
for (n <- (0 until pt.paramNames.length).toList)

0 commit comments

Comments
 (0)