From 466e52ba58604720b2dee35358d6b3545981b5b5 Mon Sep 17 00:00:00 2001 From: Edmund Noble Date: Tue, 7 Feb 2017 16:12:12 -0500 Subject: Match error lengths --- src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala') diff --git a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala index b628606897..36b9a65334 100644 --- a/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala +++ b/src/compiler/scala/tools/nsc/typechecker/TypeDiagnostics.scala @@ -308,8 +308,11 @@ trait TypeDiagnostics { !found.typeSymbol.isTypeParameterOrSkolem && !req.typeSymbol.isTypeParameterOrSkolem if (easilyMistakable) { - ";\n found : " + (foundWiden.nameAndArgsString + s" (in ${found.prefix.typeSymbol.fullNameString}) ") + explainAlias(found) + - "\n required: " + (reqWiden.nameAndArgsString + s" (in ${req.prefix.typeSymbol.fullNameString}) ") + explainAlias(req) + val longestNameLength = foundWiden.nameAndArgsString.length max reqWiden.nameAndArgsString.length + val paddedFoundName = foundWiden.nameAndArgsString.padTo(longestNameLength, ' ') + val paddedReqName = reqWiden.nameAndArgsString.padTo(longestNameLength, ' ') + ";\n found : " + (paddedFoundName + s" (in ${found.prefix.typeSymbol.fullNameString}) ") + explainAlias(found) + + "\n required: " + (paddedReqName + s" (in ${req.prefix.typeSymbol.fullNameString}) ") + explainAlias(req) } else { def baseMessage = { ";\n found : " + found.toLongString + existentialContext(found) + explainAlias(found) + -- cgit v1.2.3