diff options
author | Paul Phillips <paulp@improving.org> | 2013-03-22 13:40:02 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-03-22 13:40:02 -0700 |
commit | a16441c1d2b35980b3cca22325b1b826c5c684a4 (patch) | |
tree | 61a0d2631c570ff84b25ed6ef2586ca147b84656 /src/compiler | |
parent | 426cec50f343f6c936349e7e0cab774423218d66 (diff) | |
parent | 4bb8988e0263206fc914537c7762b0ee3b9057aa (diff) | |
download | scala-a16441c1d2b35980b3cca22325b1b826c5c684a4.tar.gz scala-a16441c1d2b35980b3cca22325b1b826c5c684a4.tar.bz2 scala-a16441c1d2b35980b3cca22325b1b826c5c684a4.zip |
Merge pull request #2259 from Blaisorblade/issue/6123-try-3
SI-6123: -explaintypes should not explain errors which won't be reported, new attempt
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala | 8 | ||||
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Infer.scala | 6 |
2 files changed, 8 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala index 86ee7939c8..17e679b5dd 100644 --- a/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala +++ b/src/compiler/scala/tools/nsc/typechecker/ContextErrors.scala @@ -172,8 +172,7 @@ trait ContextErrors { assert(!foundType.isErroneous && !req.isErroneous, (foundType, req)) issueNormalTypeError(tree, withAddendum(tree.pos)(typeErrorMsg(foundType, req, infer.isPossiblyMissingArgs(foundType, req))) ) - if (settings.explaintypes.value) - explainTypes(foundType, req) + infer.explainTypes(foundType, req) } def WithFilterError(tree: Tree, ex: AbsTypeError) = { @@ -1273,11 +1272,12 @@ trait ContextErrors { // not exactly an error generator, but very related // and I dearly wanted to push it away from Macros.scala private def checkSubType(slot: String, rtpe: Type, atpe: Type) = { - val ok = if (macroDebugVerbose || settings.explaintypes.value) { - if (rtpe eq atpe) println(rtpe + " <: " + atpe + "?" + EOL + "true") + val ok = if (macroDebugVerbose) { withTypesExplained(rtpe <:< atpe) } else rtpe <:< atpe if (!ok) { + if (!macroDebugVerbose) + explainTypes(rtpe, atpe) compatibilityError("type mismatch for %s: %s does not conform to %s".format(slot, abbreviateCoreAliases(rtpe.toString), abbreviateCoreAliases(atpe.toString))) } } diff --git a/src/compiler/scala/tools/nsc/typechecker/Infer.scala b/src/compiler/scala/tools/nsc/typechecker/Infer.scala index 15ed784ae0..f1b80d9f1c 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Infer.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Infer.scala @@ -313,8 +313,10 @@ trait Infer extends Checkable { */ ) - def explainTypes(tp1: Type, tp2: Type) = - withDisambiguation(List(), tp1, tp2)(global.explainTypes(tp1, tp2)) + def explainTypes(tp1: Type, tp2: Type) = { + if (context.reportErrors) + withDisambiguation(List(), tp1, tp2)(global.explainTypes(tp1, tp2)) + } /* -- Tests & Checks---------------------------------------------------- */ |