aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Typer.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2015-09-14 16:42:08 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2015-09-14 16:42:08 +0200
commit91f992c8af3e61a76bd862ad43b9abef9a6c3403 (patch)
tree3967effefa86da3d5c1f2e27909c30f6c1ca1266 /src/dotty/tools/dotc/typer/Typer.scala
parent406ec56c703c29ad29da2f5f6df366577d851ea5 (diff)
downloaddotty-91f992c8af3e61a76bd862ad43b9abef9a6c3403.tar.gz
dotty-91f992c8af3e61a76bd862ad43b9abef9a6c3403.tar.bz2
dotty-91f992c8af3e61a76bd862ad43b9abef9a6c3403.zip
Typer: allow to assign to vals inside trait setters.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Typer.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Typer.scala3
1 files changed, 2 insertions, 1 deletions
diff --git a/src/dotty/tools/dotc/typer/Typer.scala b/src/dotty/tools/dotc/typer/Typer.scala
index dcf4ccc6c..a2c49cdd9 100644
--- a/src/dotty/tools/dotc/typer/Typer.scala
+++ b/src/dotty/tools/dotc/typer/Typer.scala
@@ -412,7 +412,8 @@ class Typer extends Namer with TypeAssigner with Applications with Implicits wit
def lhs1 = typed(untpd.TypedSplice(lhsCore))
def canAssign(sym: Symbol) = // allow assignments from the primary constructor to class fields
sym.is(Mutable, butNot = Accessor) ||
- ctx.owner.isPrimaryConstructor && !sym.is(Method) && sym.owner == ctx.owner.owner
+ ctx.owner.isPrimaryConstructor && !sym.is(Method) && sym.owner == ctx.owner.owner ||
+ ctx.owner.name.isTraitSetterName
lhsCore.tpe match {
case ref: TermRef if canAssign(ref.symbol) =>
assignType(cpy.Assign(tree)(lhs1, typed(tree.rhs, ref.info)))