@@ -40,9 +40,14 @@ class PlainPrinter(_ctx: Context) extends Printer {
4040 def homogenize (tp : Type ): Type =
4141 if (homogenizedView)
4242 tp match {
43- case tp : TypeVar if tp.isInstantiated => homogenize(tp.instanceOpt)
44- case AndType (tp1, tp2) => homogenize(tp1) & homogenize(tp2)
45- case OrType (tp1, tp2) => homogenize(tp1) | homogenize(tp2)
43+ case tp : ThisType if tp.cls.is(Package ) && ! tp.cls.isEffectiveRoot =>
44+ ctx.requiredPackage(tp.cls.fullName).termRef
45+ case tp : TypeVar if tp.isInstantiated =>
46+ homogenize(tp.instanceOpt)
47+ case AndType (tp1, tp2) =>
48+ homogenize(tp1) & homogenize(tp2)
49+ case OrType (tp1, tp2) =>
50+ homogenize(tp1) | homogenize(tp2)
4651 case _ =>
4752 val tp1 = tp.simplifyApply
4853 if (tp1 eq tp) tp else homogenize(tp1)
@@ -230,10 +235,10 @@ class PlainPrinter(_ctx: Context) extends Printer {
230235
231236 /** The string representation of this type used as a prefix */
232237 protected def toTextPrefix (tp : Type ): Text = controlled {
233- tp match {
238+ homogenize(tp) match {
234239 case NoPrefix => " "
235240 case tp : SingletonType => toTextRef(tp) ~ " ."
236- case _ => trimPrefix(toTextLocal(tp)) ~ " #"
241+ case tp => trimPrefix(toTextLocal(tp)) ~ " #"
237242 }
238243 }
239244
@@ -253,7 +258,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
253258
254259 /** String representation of a definition's type following its name */
255260 protected def toTextRHS (tp : Type ): Text = controlled {
256- tp match {
261+ homogenize(tp) match {
257262 case tp @ TypeBounds (lo, hi) =>
258263 if (lo eq hi) {
259264 val eql =
@@ -280,7 +285,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
280285 else dclsText(trueDecls)
281286 tparamsText ~ " extends " ~ toTextParents(tp.parents) ~ " {" ~ selfText ~ declsText ~
282287 " } at " ~ preText
283- case _ =>
288+ case tp =>
284289 " : " ~ toTextGlobal(tp)
285290 }
286291 }
0 commit comments