@@ -717,40 +717,27 @@ class PlainPrinter(_ctx: Context) extends Printer {
717
717
try
718
718
// The current TyperState constraint determines how type variables are printed
719
719
ctx.typerState.constraint = c
720
- def entryText (tp : Type ) = tp match {
721
- case tp : TypeBounds =>
722
- toText(tp)
723
- case _ =>
724
- " := " ~ toText(tp)
725
- }
726
- val indent = 3
727
- val uninstVarsText = " uninstantiated variables: " ~
728
- Text (c.uninstVars.map(toText), " , " )
729
- val constrainedText =
730
- " constrained types: " ~ Text (c.domainLambdas.map(toText), " , " )
731
- val boundsText =
732
- " bounds: " ~ {
733
- val assocs =
734
- for (param <- c.domainParams)
735
- yield (" " * indent) ~ toText(param) ~ entryText(c.entry(param))
736
- Text (assocs, " \n " )
737
- }
738
- val orderingText =
739
- " ordering: " ~ {
740
- val deps =
741
- for {
742
- param <- c.domainParams
743
- ups = c.minUpper(param)
744
- if ups.nonEmpty
745
- }
746
- yield
747
- (" " * indent) ~ toText(param) ~ " <: " ~
748
- Text (ups.map(toText), " , " )
749
- Text (deps, " \n " )
750
- }
751
- val depsText = if Config .showConstraintDeps then c.depsToString else " "
720
+
721
+ def depsText (k : TypeParamRef , vs : List [TypeParamRef ]): Text =
722
+ (toText(k) ~ " --> " ) ~: (" [" ~ toText(vs, " , " ) ~ " ]" ).provided(vs.nonEmpty && Config .showConstraintDeps).close
723
+
724
+ def orderText (p : TypeParamRef , op : String , doms : List [TypeParamRef ], sep : String ) =
725
+ (toText(p) ~ op) ~: Text (doms.map(toText), sep)
726
+
752
727
// Printer.debugPrintUnique = false
753
- Text .lines(List (uninstVarsText, constrainedText, boundsText, orderingText, depsText))
728
+ val parts = List (
729
+ " uninsts: " ~: Text (c.uninstVars.map(toText), " , " ),
730
+ " lambdas: " ~: Text (c.domainLambdas.map(toText), " , " ),
731
+ " bounds: " ~: Text (c.domainParams.map(p => toText(p) ~: toText(TypeComparer .fullBounds(p))), " , " ),
732
+ " uppers: " ~: Text (c.domainParams.map(p => orderText(p, " <: " , c.minUpper(p), " & " )), " , " ),
733
+ " lowers: " ~: Text (c.domainParams.map(p => orderText(p, " >: " , c.minLower(p), " | " )), " , " ),
734
+ " covdeps: " ~: Text (c.covDeps.map2((k, vs) => depsText(k, vs.toList)), " , " ),
735
+ " condeps: " ~: Text (c.conDeps.map2((k, vs) => depsText(k, vs.toList)), " , " ),
736
+ ).filter(! _.isEmpty).map(_.close)
737
+
738
+ if parts.sizeIs > 1
739
+ then " Constr:" ~ Text (parts, " \n " )
740
+ else " Constr(" ~ Text (parts, " , " ) ~ " )"
754
741
finally
755
742
ctx.typerState.constraint = savedConstraint
756
743
0 commit comments