@@ -40,9 +40,14 @@ class PlainPrinter(_ctx: Context) extends Printer {
40
40
def homogenize (tp : Type ): Type =
41
41
if (homogenizedView)
42
42
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)
46
51
case _ =>
47
52
val tp1 = tp.simplifyApply
48
53
if (tp1 eq tp) tp else homogenize(tp1)
@@ -230,10 +235,10 @@ class PlainPrinter(_ctx: Context) extends Printer {
230
235
231
236
/** The string representation of this type used as a prefix */
232
237
protected def toTextPrefix (tp : Type ): Text = controlled {
233
- tp match {
238
+ homogenize(tp) match {
234
239
case NoPrefix => " "
235
240
case tp : SingletonType => toTextRef(tp) ~ " ."
236
- case _ => trimPrefix(toTextLocal(tp)) ~ " #"
241
+ case tp => trimPrefix(toTextLocal(tp)) ~ " #"
237
242
}
238
243
}
239
244
@@ -253,7 +258,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
253
258
254
259
/** String representation of a definition's type following its name */
255
260
protected def toTextRHS (tp : Type ): Text = controlled {
256
- tp match {
261
+ homogenize(tp) match {
257
262
case tp @ TypeBounds (lo, hi) =>
258
263
if (lo eq hi) {
259
264
val eql =
@@ -280,7 +285,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
280
285
else dclsText(trueDecls)
281
286
tparamsText ~ " extends " ~ toTextParents(tp.parents) ~ " {" ~ selfText ~ declsText ~
282
287
" } at " ~ preText
283
- case _ =>
288
+ case tp =>
284
289
" : " ~ toTextGlobal(tp)
285
290
}
286
291
}
0 commit comments