diff options
author | Martin Odersky <odersky@gmail.com> | 2014-04-13 12:40:19 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-04-14 15:17:35 +0200 |
commit | e5ae4a707b2bb78f0777660b0661a3162bf646df (patch) | |
tree | f4a5886bf8295834d2e9de6548aaee7450877e19 /src | |
parent | 732a690ad2ef78450f6b8852b0f1f0ba892b392d (diff) | |
download | dotty-e5ae4a707b2bb78f0777660b0661a3162bf646df.tar.gz dotty-e5ae4a707b2bb78f0777660b0661a3162bf646df.tar.bz2 dotty-e5ae4a707b2bb78f0777660b0661a3162bf646df.zip |
Fixing prefix of implicit members
Implicit members are TermRefs that should have a prefix corresponding to the object of which they are a member. They used to have the ThisType of their owner before.
`implicits2` provides a way to verify that the change works. It would be good to turn this
into a more robust test at some point. But it's not high preiority, so I prefer no test to a fragile test.
Diffstat (limited to 'src')
-rw-r--r-- | src/dotty/tools/dotc/core/Types.scala | 4 | ||||
-rw-r--r-- | src/dotty/tools/dotc/printing/RefinedPrinter.scala | 5 |
2 files changed, 5 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/core/Types.scala b/src/dotty/tools/dotc/core/Types.scala index c348e246c..ecad89afc 100644 --- a/src/dotty/tools/dotc/core/Types.scala +++ b/src/dotty/tools/dotc/core/Types.scala @@ -449,7 +449,7 @@ object Types { final def implicitMembers(implicit ctx: Context): List[TermRef] = track("implicitMembers") { memberDenots(implicitFilter, (name, buf) => buf ++= member(name).altsWith(_ is Implicit)) - .toList.map(_.termRefWithSig) + .toList.map(d => TermRef.withSig(this, d.symbol.asTerm)) } /** The info of `sym`, seen as a member of this type. */ @@ -1311,7 +1311,7 @@ object Types { if (prefix eq NoPrefix) withNonMemberSym(prefix, name, sym) else { if (sym.defRunId != NoRunId && sym.isCompleted) withSig(prefix, name, sym.signature) - else apply(prefix, name) + else apply(prefix, name) } withSym (sym, Signature.NotAMethod) def withSig(prefix: Type, sym: TermSymbol)(implicit ctx: Context): TermRef = diff --git a/src/dotty/tools/dotc/printing/RefinedPrinter.scala b/src/dotty/tools/dotc/printing/RefinedPrinter.scala index f9cd9ec72..dd8f04d92 100644 --- a/src/dotty/tools/dotc/printing/RefinedPrinter.scala +++ b/src/dotty/tools/dotc/printing/RefinedPrinter.scala @@ -54,13 +54,14 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) { } override def toTextPrefix(tp: Type): Text = controlled { + def isOmittable(sym: Symbol) = isOmittablePrefix(sym) && !ctx.settings.verbose.value tp match { case ThisType(cls) => - if (isOmittablePrefix(cls)) return "" + if (isOmittable(cls)) return "" case tp @ TermRef(pre, _) => val sym = tp.symbol if (sym.isPackageObject) return toTextPrefix(pre) - if (isOmittablePrefix(sym)) return "" + if (isOmittable(sym)) return "" case _ => } super.toTextPrefix(tp) |