@@ -1657,18 +1657,28 @@ trait Implicits {
16571657 def formatParameterMessage (fun : Tree ): String = {
16581658 val paramNames = referencedTypeParams
16591659 val paramSyms = paramNames.map(lookupTypeParam).filterNot(_ == NoSymbol )
1660- val paramTypeRefs = paramSyms.map(sym => typeRef( NoPrefix , sym, sym.typeParams.map(_ => WildcardType )))
1660+ val paramTypeRefs = paramSyms.map(_.typeConstructor.etaExpand) // make polytypes for type constructors -- we'll abbreviate them below
16611661 val prefix = fun match {
1662- case TypeApply (Select (qual, _), _) => qual.tpe
1663- case Select (qual, _) => qual.tpe
1662+ case treeInfo.Applied (Select (qual, _), _, _) => qual.tpe
16641663 case _ => NoType
16651664 }
1665+
16661666 val argTypes1 = if (prefix == NoType ) paramTypeRefs else paramTypeRefs.map(t => t.asSeenFrom(prefix, fun.symbol.owner))
16671667 val argTypes2 = fun match {
16681668 case TypeApply (_, targs) => argTypes1.map(_.instantiateTypeParams(fun.symbol.info.typeParams, targs.map(_.tpe)))
16691669 case _ => argTypes1
16701670 }
1671- val argTypes = argTypes2.map(_.toString)
1671+
1672+ val argTypes = argTypes2.map{
1673+ case PolyType (tps, tr@ TypeRef (_, _, tprefs)) =>
1674+ if (tps.corresponds(tprefs)((p, r) => p == r.typeSymbol)) tr.typeConstructor.toString
1675+ else {
1676+ val freshTpars = tps.mapConserve { case p if p.name == tpnme.WILDCARD => p.cloneSymbol.setName(newTypeName(" ?T" + tps.indexOf(p))) case p => p }
1677+ freshTpars.map(_.name).mkString(" [" , " , " , " ] -> " ) + tr.instantiateTypeParams(tps, freshTpars.map(_.typeConstructor)).toString
1678+ }
1679+
1680+ case tp => tp.toString
1681+ }
16721682 interpolate(msg, Map (paramNames zip argTypes : _* ))
16731683 }
16741684
0 commit comments