diff options
author | Paul Phillips <paulp@improving.org> | 2011-12-03 15:05:25 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2011-12-03 15:28:37 -0800 |
commit | f7d436a0abf350ff573f155392393c357f489a93 (patch) | |
tree | a9a040212724c8f42db1e4daa4e2388829944b59 | |
parent | 3d7c75089eae06b3d439ff1acd8bba5a189463da (diff) | |
download | scala-f7d436a0abf350ff573f155392393c357f489a93.tar.gz scala-f7d436a0abf350ff573f155392393c357f489a93.tar.bz2 scala-f7d436a0abf350ff573f155392393c357f489a93.zip |
Eliminated redundant error message.
No secondary "reassignment to val" for unknown identifiers
in assignment position.
-rw-r--r-- | src/compiler/scala/tools/nsc/typechecker/Typers.scala | 8 | ||||
-rw-r--r-- | test/files/neg/reassignment.check | 13 | ||||
-rw-r--r-- | test/files/neg/reassignment.scala | 7 | ||||
-rw-r--r-- | test/files/neg/t0903.check | 2 |
4 files changed, 24 insertions, 6 deletions
diff --git a/src/compiler/scala/tools/nsc/typechecker/Typers.scala b/src/compiler/scala/tools/nsc/typechecker/Typers.scala index b969e9629f..16c0cb40ff 100644 --- a/src/compiler/scala/tools/nsc/typechecker/Typers.scala +++ b/src/compiler/scala/tools/nsc/typechecker/Typers.scala @@ -3457,12 +3457,10 @@ trait Typers extends Modes with Adaptations with PatMatVirtualiser { if (treeInfo.isVariableOrGetter(qual1)) { stopTimer(failedOpEqNanos, opeqStart) convertToAssignment(fun, qual1, name, args, ex) - } else { + } + else { stopTimer(failedApplyNanos, appStart) - if ((qual1.symbol ne null) && qual1.symbol.isValue) - error(tree.pos, "reassignment to val") - else - reportTypeError(fun.pos, ex) + reportTypeError(fun.pos, ex) setError(tree) } case _ => diff --git a/test/files/neg/reassignment.check b/test/files/neg/reassignment.check new file mode 100644 index 0000000000..f0effd1459 --- /dev/null +++ b/test/files/neg/reassignment.check @@ -0,0 +1,13 @@ +reassignment.scala:2: error: not found: value x + x = 5 + ^ +reassignment.scala:3: error: not found: value y + y := 45 + ^ +reassignment.scala:4: error: not found: value y + y += 45 + ^ +reassignment.scala:6: error: reassignment to val + z = 51 + ^ +four errors found diff --git a/test/files/neg/reassignment.scala b/test/files/neg/reassignment.scala new file mode 100644 index 0000000000..e31eefbf3f --- /dev/null +++ b/test/files/neg/reassignment.scala @@ -0,0 +1,7 @@ +class A { + x = 5 + y := 45 + y += 45 + val z = 50 + z = 51 +}
\ No newline at end of file diff --git a/test/files/neg/t0903.check b/test/files/neg/t0903.check index db4cd94d2c..2dd05cd3ee 100644 --- a/test/files/neg/t0903.check +++ b/test/files/neg/t0903.check @@ -1,4 +1,4 @@ -t0903.scala:3: error: reassignment to val +t0903.scala:3: error: value += is not a member of Int x += 1 ^ t0903.scala:4: error: reassignment to val |