Skip to content

Commit cfd13f7

Browse files
committed
Fix to printing type parameters.
Printing a type parameter reference `A#T` now only reduces to `T` if `A` is some `B.this.type`.
1 parent 9a6a4e8 commit cfd13f7

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/dotty/tools/dotc/core/transform/Erasure.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ class Erasure(isJava: Boolean, isSemi: Boolean, isConstructor: Boolean, wildcard
247247
sigName(tp.optBounds)
248248
case _ =>
249249
val erased = this(tp)
250-
assert(erased ne tp)
250+
assert(erased ne tp, tp)
251251
sigName(erased)
252252
}
253253
}

src/dotty/tools/dotc/printing/RefinedPrinter.scala

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,9 +110,9 @@ class RefinedPrinter(_ctx: Context) extends PlainPrinter(_ctx) {
110110
}
111111
case tp: TypeRef =>
112112
if ((tp.symbol is TypeParam | TypeArgument) && !ctx.phase.erasedTypes) {
113-
return tp.info match {
114-
case TypeAlias(hi) => toText(hi)
115-
case _ => nameString(tp.symbol)
113+
tp.info match {
114+
case TypeAlias(hi) => return toText(hi)
115+
case _ => if (tp.prefix.isInstanceOf[ThisType]) return nameString(tp.symbol)
116116
}
117117
}
118118
else if (tp.symbol.isAnonymousClass)

0 commit comments

Comments
 (0)