aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-01-13 18:29:16 +0100
committerMartin Odersky <odersky@gmail.com>2014-01-13 18:29:16 +0100
commit504ca664b403a942983002e41e06efae20b397b5 (patch)
tree80c9d871939d5e44a8b919a2599e2ae033cae859
parentbbe5f17384e8e1ed5492516ca0d9e397cd770823 (diff)
downloaddotty-504ca664b403a942983002e41e06efae20b397b5.tar.gz
dotty-504ca664b403a942983002e41e06efae20b397b5.tar.bz2
dotty-504ca664b403a942983002e41e06efae20b397b5.zip
Better handling of assignment.
Problem: lhs = expr where the lhs takes an implicit. An implicit argument might not be available at the assignment site, but the epxression should typecheck anyway. Test case in SymDenotations.NoDenotation.
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala8
1 files changed, 4 insertions, 4 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index 18f6fa89a..a416d734a 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -460,15 +460,15 @@ class Typer extends Namer with Applications with Implicits {
untpd.Select(untpd.TypedSplice(fn), nme.update),
(args map untpd.TypedSplice) :+ tree.rhs), pt)
case lhs =>
- val lhs1 = typed(lhs)
- lhs1.tpe match {
+ val lhsCore = typedUnadapted(lhs)
+ def lhs1 = typed(untpd.TypedSplice(lhsCore))
+ lhsCore.tpe match {
case ref: TermRef if ref.symbol is (Mutable, butNot = Accessor) =>
cpy.Assign(tree, lhs1, typed(tree.rhs, ref.info)).withType(defn.UnitType)
case _ =>
def reassignmentToVal =
- errorTree(cpy.Assign(tree, lhs1, typed(tree.rhs, lhs1.tpe.widen)),
+ errorTree(cpy.Assign(tree, lhsCore, typed(tree.rhs, lhs1.tpe.widen)),
"reassignment to val")
- val lhsCore = stripApply(lhs1) // need to strip off any implicit parameters
lhsCore.tpe match {
case ref: TermRef => // todo: further conditions to impose on getter?
val pre = ref.prefix