@@ -641,6 +641,14 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
641641
642642 /** Display spaces */
643643 def show (s : Space ): String = {
644+
645+ /** does the companion object of the given symbol have custom unapply */
646+ def hasCustomUnapply (sym : Symbol ): Boolean = {
647+ val companion = sym.companionModule
648+ companion.findMember(nme.unapply, NoPrefix , excluded = Synthetic ).exists ||
649+ companion.findMember(nme.unapplySeq, NoPrefix , excluded = Synthetic ).exists
650+ }
651+
644652 def doShow (s : Space , mergeList : Boolean = false ): String = s match {
645653 case Empty => " "
646654 case Typ (c : ConstantType , _) => c.value.show
@@ -654,11 +662,9 @@ class SpaceEngine(implicit ctx: Context) extends SpaceLogic {
654662 if (mergeList) " _*" else " _: List"
655663 else if (scalaConsType.isRef(sym))
656664 if (mergeList) " _" else " List(_)"
657- else if (tp.classSymbol.is(CaseClass ))
665+ else if (tp.classSymbol.is(CaseClass ) && ! hasCustomUnapply(tp.classSymbol) )
658666 // use constructor syntax for case class
659667 showType(tp) + signature(tp).map(_ => " _" ).mkString(" (" , " , " , " )" )
660- else if (signature(tp).nonEmpty)
661- tp.classSymbol.name + signature(tp).map(_ => " _" ).mkString(" (" , " , " , " )" )
662668 else if (decomposed) " _: " + showType(tp)
663669 else " _"
664670 case Kon (tp, params) =>
0 commit comments