diff options
author | Som Snytt <som.snytt@gmail.com> | 2016-11-25 13:24:30 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2016-11-25 13:24:30 -0800 |
commit | 76598e8bf8dad1979da14bc1ebb8e84859ef2a83 (patch) | |
tree | 2068e74d619f9348649549266e8a62d9c1368f64 /src/compiler | |
parent | 55c6ad4f8a191e691efdbee0a1bbddc4efb66f35 (diff) | |
download | scala-76598e8bf8dad1979da14bc1ebb8e84859ef2a83.tar.gz scala-76598e8bf8dad1979da14bc1ebb8e84859ef2a83.tar.bz2 scala-76598e8bf8dad1979da14bc1ebb8e84859ef2a83.zip |
SI-9834 Show expansion of update on error
Diffstat (limited to 'src/compiler')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index cddfece32d..00e0517df6 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4510,11 +4510,12 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper args foreach (arg => typed(arg, mode, ErrorType)) setError(tree) } - def advice1(errors: List[AbsTypeError], err: SilentTypeError): List[AbsTypeError] = + def advice1(convo: Tree, errors: List[AbsTypeError], err: SilentTypeError): List[AbsTypeError] = errors.map { e => if (e.errPos == tree.pos) { val header = f"${e.errMsg}%n Expression does not convert to assignment because:%n " - NormalTypeError(tree, err.errors.flatMap(_.errMsg.lines.toList).mkString(header, f"%n ", "")) + val expansion = f"%n expansion: ${show(convo)}" + NormalTypeError(tree, err.errors.flatMap(_.errMsg.lines.toList).mkString(header, f"%n ", expansion)) } else e } def advice2(errors: List[AbsTypeError]): List[AbsTypeError] = @@ -4534,7 +4535,7 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val convo = convertToAssignment(fun, qual1, name, args) silent(op = _.typed1(convo, mode, pt)) match { case SilentResultValue(t) => t - case err: SilentTypeError => reportError(SilentTypeError(advice1(error.errors, err), error.warnings)) + case err: SilentTypeError => reportError(SilentTypeError(advice1(convo, error.errors, err), error.warnings)) } } } |