Skip to content

Commit 9758725

Browse files
committed
Elide this for types in parent list
1 parent 8b018eb commit 9758725

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

library/src/scala/tasty/reflect/Printers.scala

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -609,7 +609,7 @@ trait Printers
609609

610610
def printParent(parent: TermOrTypeTree, needEmptyParens: Boolean = false): Unit = parent match {
611611
case IsTypeTree(parent) =>
612-
printTypeTree(parent)
612+
printTypeTree(parent, Some(cdef.symbol))
613613
case IsTerm(Term.TypeApply(fun, targs)) =>
614614
printParent(fun)
615615
case IsTerm(Term.Apply(fun@Term.Apply(_,_), args)) =>
@@ -621,7 +621,7 @@ trait Printers
621621
if (!args.isEmpty || needEmptyParens)
622622
inParens(printTrees(args, ", "))
623623
case IsTerm(Term.Select(Term.New(tpt), _)) =>
624-
printTypeTree(tpt)
624+
printTypeTree(tpt, Some(cdef.symbol))
625625
case IsTerm(parent) =>
626626
throw new MatchError(parent.show)
627627
}
@@ -1359,6 +1359,8 @@ trait Printers
13591359
* NoSymbol means the current type is not a self type annotation.
13601360
* Self type annotation should elide current class prefix to avoid
13611361
* cyclic type checking error.
1362+
*
1363+
* It is also used in parent list to avoid `this` prefix.
13621364
*/
13631365
def printTypeTree(tree: TypeTree, selfIn: Option[Symbol] = None): Buffer = tree match {
13641366
case TypeTree.Inferred() =>
@@ -1470,6 +1472,8 @@ trait Printers
14701472
* @param selfIn The current type is a self type in the indicated class.
14711473
* Self type annotation should elide current class prefix to avoid
14721474
* cyclic type checking error.
1475+
*
1476+
* It is also used in parent list to avoid `this` prefix.
14731477
*/
14741478
def printType(tpe: Type, selfIn: Option[Symbol] = None): Buffer = tpe match {
14751479
case Type.ConstantType(const) =>

0 commit comments

Comments
 (0)