File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -144,9 +144,14 @@ object Implicits {
144
144
class ContextualImplicits (val refs : List [TermRef ], val outerImplicits : ContextualImplicits )(initctx : Context ) extends ImplicitRefs (initctx) {
145
145
private val eligibleCache = new mutable.AnyRefMap [Type , List [Candidate ]]
146
146
147
+ /** The level increases if current context has a different owner or scope than
148
+ * the context of the next-outer ImplicitRefs. This is however disabled under
149
+ * Scala2 mode, since we do not want to change the implicit disambiguation then.
150
+ */
147
151
override val level : Int =
148
152
if (outerImplicits == null ) 1
149
- else if ((ctx.owner eq outerImplicits.ctx.owner) &&
153
+ else if (ctx.scala2Mode ||
154
+ (ctx.owner eq outerImplicits.ctx.owner) &&
150
155
(ctx.scope eq outerImplicits.ctx.scope)) outerImplicits.level
151
156
else outerImplicits.level + 1
152
157
You can’t perform that action at this time.
0 commit comments