diff options
-rw-r--r-- | src/dotty/tools/dotc/ast/Desugar.scala | 7 | ||||
-rw-r--r-- | tests/pos/i1216.scala | 11 | ||||
-rw-r--r-- | tests/pos/i1216a.scala | 11 |
3 files changed, 27 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) diff --git a/tests/pos/i1216.scala b/tests/pos/i1216.scala new file mode 100644 index 000000000..74c2d6c9a --- /dev/null +++ b/tests/pos/i1216.scala @@ -0,0 +1,11 @@ +object Main { + val MAX = 10 + val s1, s2, target = new Array[Long](MAX) + + var i, j = 0 + + while (i < MAX) { + target(i) = s1(i) + s2(i) + i+= 1 + } +} diff --git a/tests/pos/i1216a.scala b/tests/pos/i1216a.scala new file mode 100644 index 000000000..0652ff7a2 --- /dev/null +++ b/tests/pos/i1216a.scala @@ -0,0 +1,11 @@ +object Main { + val MAX = 10 + val s1, s2, target = new Array[Long](MAX) + + var i = 0 + + while (i < MAX) { + target(i) = s1(i) + s2(i) + i+= 1 + } +} |