aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Desugar.scala
diff options
context:
space:
mode:
authorDmitry Petrashko <dmitry.petrashko@gmail.com>2016-04-14 17:07:49 +0200
committerDmitry Petrashko <dmitry.petrashko@gmail.com>2016-04-14 17:07:49 +0200
commitc47eba5dd805c355efa93d21ac881d1ca755eef4 (patch)
treeb20d0b58865bf31a28182efa72aadaf369000bfb /src/dotty/tools/dotc/ast/Desugar.scala
parentfcf0efe1d70bd71b212f07a5764196860a7c4148 (diff)
downloaddotty-c47eba5dd805c355efa93d21ac881d1ca755eef4.tar.gz
dotty-c47eba5dd805c355efa93d21ac881d1ca755eef4.tar.bz2
dotty-c47eba5dd805c355efa93d21ac881d1ca755eef4.zip
Fix #1216 Desugar: vals that are desugared PatDef may need setters.
Setters are normally synthesised in Desugar while expanding the ValDef. If the tree is a PatDef it is being desugared into several ValDefs that may need to be desugared once again.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Desugar.scala')
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala7
1 files changed, 5 insertions, 2 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index 719f3d036..ac2f8ae73 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -634,8 +634,11 @@ object desugar {
def makeAnnotated(cls: Symbol, tree: Tree)(implicit ctx: Context) =
Annotated(untpd.New(untpd.TypeTree(cls.typeRef), Nil), tree)
- private def derivedValDef(named: NameTree, tpt: Tree, rhs: Tree, mods: Modifiers) =
- ValDef(named.name.asTermName, tpt, rhs).withMods(mods).withPos(named.pos)
+ private def derivedValDef(named: NameTree, tpt: Tree, rhs: Tree, mods: Modifiers)(implicit ctx: Context) = {
+ val vdef = ValDef(named.name.asTermName, tpt, rhs).withMods(mods).withPos(named.pos)
+ val mayNeedSetter = valDef(vdef)
+ mayNeedSetter
+ }
private def derivedDefDef(named: NameTree, tpt: Tree, rhs: Tree, mods: Modifiers) =
DefDef(named.name.asTermName, Nil, Nil, tpt, rhs).withMods(mods).withPos(named.pos)