diff options
author | Olli Helenius <liff@iki.fi> | 2016-05-19 23:05:45 +0300 |
---|---|---|
committer | Olli Helenius <liff@iki.fi> | 2016-05-20 07:54:47 +0300 |
commit | 6be9fc678b8af5df915905059fd31f0fc1d9d821 (patch) | |
tree | 1319d38ea07b6f9228b54235495daaad62f168ca /src | |
parent | 15189d14953335f7a3a8310861d045d21ab22d48 (diff) | |
download | scala-6be9fc678b8af5df915905059fd31f0fc1d9d821.tar.gz scala-6be9fc678b8af5df915905059fd31f0fc1d9d821.tar.bz2 scala-6be9fc678b8af5df915905059fd31f0fc1d9d821.zip |
SI-9781 Don't convert erroneous expression to assignment
`convertToAssignment` is triggered on a type error but it doesn't seem
to really care what the error is as long as the expression can be
converted to an assignment expression.
This patch fixes that by checking whether the qualifier of the selection
contains any errors before deciding to continue with the conversion.
Diffstat (limited to 'src')
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index 329ce8c23b..1aed9c3a64 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -4494,7 +4494,9 @@ trait Typers extends Adaptations with Tags with TypersTracking with PatternTyper val opeqStart = if (Statistics.canEnable) Statistics.startTimer(failedOpEqNanos) else null def onError(reportError: => Tree): Tree = fun match { - case Select(qual, name) if !mode.inPatternMode && nme.isOpAssignmentName(newTermName(name.decode)) => + case Select(qual, name) + if !mode.inPatternMode && nme.isOpAssignmentName(newTermName(name.decode)) && !qual.exists(_.isErroneous) => + val qual1 = typedQualifier(qual) if (treeInfo.isVariableOrGetter(qual1)) { if (Statistics.canEnable) Statistics.stopTimer(failedOpEqNanos, opeqStart) |