@@ -758,7 +758,7 @@ trait Printers
758758 printType(tree.tpe)
759759
760760 case Term .Select (qual, name) =>
761- printTree (qual)
761+ printQualTree (qual)
762762 if (name != " <init>" && name != " package" )
763763 this += " ." += name
764764 this
@@ -809,7 +809,7 @@ trait Printers
809809 case Term .Apply (fn, args) =>
810810 fn match {
811811 case Term .Select (Term .This (_), " <init>" ) => this += " this" // call to constructor inside a constructor
812- case _ => printTree (fn)
812+ case _ => printQualTree (fn)
813813 }
814814 val args1 = args match {
815815 case init :+ Term .Typed (Term .Repeated (Nil , _), _) => init // drop empty var args at the end
@@ -819,7 +819,7 @@ trait Printers
819819 inParens(printTrees(args1, " , " ))
820820
821821 case Term .TypeApply (fn, args) =>
822- printTree (fn)
822+ printQualTree (fn)
823823 fn match {
824824 case Term .Select (Term .New (TypeTree .Applied (_, _)), " <init>" ) =>
825825 // type bounds already printed in `fn`
@@ -894,7 +894,7 @@ trait Printers
894894 printTree(elsep)
895895
896896 case Term .Match (selector, cases) =>
897- printTree (selector)
897+ printQualTree (selector)
898898 this += highlightKeyword(" match" , color)
899899 inBlock(printCases(cases, lineBreak()))
900900
@@ -941,6 +941,14 @@ trait Printers
941941
942942 }
943943
944+ def printQualTree (tree : Tree ): Buffer = tree match {
945+ case Term .IsIf (_) | Term .IsMatch (_) | Term .IsWhile (_) | Term .IsTry (_) | Term .IsReturn (_) =>
946+ this += " ("
947+ printTree(tree)
948+ this += " )"
949+ case _ => printTree(tree)
950+ }
951+
944952 def flatBlock (stats : List [Statement ], expr : Term ): (List [Statement ], Term ) = {
945953 val flatStats = List .newBuilder[Statement ]
946954 def extractFlatStats (stat : Statement ): Unit = stat match {
0 commit comments