aboutsummaryrefslogtreecommitdiff
path: root/compiler/src/dotty/tools/dotc/typer/Implicits.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2016-12-05 11:14:31 +0100
committerMartin Odersky <odersky@gmail.com>2016-12-17 18:34:27 +0100
commitb804d9167a79fc6330ad4a193685da95c6ef9bca (patch)
tree0202169b8e0292660807d8aea01431fb327c28f3 /compiler/src/dotty/tools/dotc/typer/Implicits.scala
parentbcc80ad1343a3ed01bef55f494d9658cf02226c6 (diff)
downloaddotty-b804d9167a79fc6330ad4a193685da95c6ef9bca.tar.gz
dotty-b804d9167a79fc6330ad4a193685da95c6ef9bca.tar.bz2
dotty-b804d9167a79fc6330ad4a193685da95c6ef9bca.zip
Don't look at nesting for implicit resolution under Scala2 mode.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/typer/Implicits.scala')
-rw-r--r--compiler/src/dotty/tools/dotc/typer/Implicits.scala7
1 files changed, 6 insertions, 1 deletions
diff --git a/compiler/src/dotty/tools/dotc/typer/Implicits.scala b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
index 79cab8b74..331533204 100644
--- a/compiler/src/dotty/tools/dotc/typer/Implicits.scala
+++ b/compiler/src/dotty/tools/dotc/typer/Implicits.scala
@@ -144,9 +144,14 @@ object Implicits {
class ContextualImplicits(val refs: List[TermRef], val outerImplicits: ContextualImplicits)(initctx: Context) extends ImplicitRefs(initctx) {
private val eligibleCache = new mutable.AnyRefMap[Type, List[Candidate]]
+ /** The level increases if current context has a different owner or scope than
+ * the context of the next-outer ImplicitRefs. This is however disabled under
+ * Scala2 mode, since we do not want to change the implicit disambiguation then.
+ */
override val level: Int =
if (outerImplicits == null) 1
- else if ((ctx.owner eq outerImplicits.ctx.owner) &&
+ else if (ctx.scala2Mode ||
+ (ctx.owner eq outerImplicits.ctx.owner) &&
(ctx.scope eq outerImplicits.ctx.scope)) outerImplicits.level
else outerImplicits.level + 1