diff options
author | Martin Odersky <odersky@gmail.com> | 2013-12-19 18:57:03 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-12-19 18:57:03 +0100 |
commit | 8420bbee7fa5eadeb58f0f54a7089b6f2048575e (patch) | |
tree | 1e7c3e32feaabab4d47e228168dd3daff7b02987 /src | |
parent | 3d2c4454640f6e410b9413eac885c65f1f9763f5 (diff) | |
download | dotty-8420bbee7fa5eadeb58f0f54a7089b6f2048575e.tar.gz dotty-8420bbee7fa5eadeb58f0f54a7089b6f2048575e.tar.bz2 dotty-8420bbee7fa5eadeb58f0f54a7089b6f2048575e.zip |
More shadowing tweaking.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/typer/Implicits.scala | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Implicits.scala b/src/dotty/tools/dotc/typer/Implicits.scala index 6e29f8d04..b32535167 100644 --- a/src/dotty/tools/dotc/typer/Implicits.scala +++ b/src/dotty/tools/dotc/typer/Implicits.scala @@ -322,12 +322,18 @@ trait Implicits { self: Typer => val generated1 = adapt(generated, pt) lazy val shadowing = typed(untpd.Ident(ref.name) withPos pos.toSynthetic, funProto)(nestedContext.withNewTyperState) - def shadowingSym = closureBody(shadowing).symbol + def refMatches(shadowing: Tree): Boolean = + ref.symbol == closureBody(shadowing).symbol || { + shadowing match { + case Trees.Select(qual, nme.apply) => refMatches(qual) + case _ => false + } + } if (ctx.typerState.reporter.hasErrors) nonMatchingImplicit(ref) - else if (contextual && shadowingSym != ref.symbol) { - println(i"SHADOWING $ref is shadowed by $shadowing with sym ${shadowingSym} of type ${methPart(shadowing).tpe}, funproto = ${funProto.getClass}") - shadowedImplicit(ref, if (shadowingSym.exists) shadowingSym.typeRef else methPart(shadowing).tpe) + else if (contextual && !refMatches(shadowing)) { + println(i"SHADOWING $ref is shadowed by $shadowing") + shadowedImplicit(ref, methPart(shadowing).tpe) } else SearchSuccess(generated, ref, ctx.typerState) |