summaryrefslogtreecommitdiff
path: root/test/files/pos/t6921.scala
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2013-03-13 19:03:53 +0100
committerJason Zaugg <jzaugg@gmail.com>2013-03-13 21:11:13 +0100
commit174334b9095be2be79c164bbdea1749dab9e0cbe (patch)
tree5a6a2113b41b059cf79067ae745ce790046c3fdd /test/files/pos/t6921.scala
parentb7b4f877326acd6a8a24ff60fa1638cc18143c45 (diff)
downloadscala-174334b9095be2be79c164bbdea1749dab9e0cbe.tar.gz
scala-174334b9095be2be79c164bbdea1749dab9e0cbe.tar.bz2
scala-174334b9095be2be79c164bbdea1749dab9e0cbe.zip
SI-6921 SI-7239 Tread lightly during exploratory typing
When deciding whether an Assign is a named argument or and assignment expression, or when looking at arguments that the current selection is applied to in order to evaluate candidate implicit views, we risk polluting the tree by setting error types. This happens even if we are in 'silent' mode; that mode does silence the error report, but not the side effect on the tree. This commit adds strategic `duplicate` calls to address the problem symptomatically. Duplicating trees and retyping in general reach into the domain of bugs umbrella-ed under SI-5464, but in these places we should be safe because the tree is in the argument position, not somewhere where, for example, a case class-es synthetic companion object might be twice entered into the same scope. Longer term, we'd like to make type checking side effect free, so we wouldn't need to play whack-a-mole like this. That idea is tracked under SI-7176.
Diffstat (limited to 'test/files/pos/t6921.scala')
-rw-r--r--test/files/pos/t6921.scala11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t6921.scala b/test/files/pos/t6921.scala
new file mode 100644
index 0000000000..36e70e5d2c
--- /dev/null
+++ b/test/files/pos/t6921.scala
@@ -0,0 +1,11 @@
+class Message(messageType: String, reason: Option[String])
+
+class ReproForSI6921 {
+
+ private[this] var reason = ""
+
+ def decideElection = {
+ val explanation = None
+ new Message("", reason = explanation)
+ }
+}