aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/ast/Trees.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-11-10 18:46:34 +0100
committerMartin Odersky <odersky@gmail.com>2014-11-10 18:46:34 +0100
commit02f329c566d10f1928d91efa865d6e164ea757e7 (patch)
treec34f7513ae7eedba81ec4eed660e966ace1a68e5 /src/dotty/tools/dotc/ast/Trees.scala
parentf7a4d811f769583be13a376a3daedd2eadd31447 (diff)
downloaddotty-02f329c566d10f1928d91efa865d6e164ea757e7.tar.gz
dotty-02f329c566d10f1928d91efa865d6e164ea757e7.tar.bz2
dotty-02f329c566d10f1928d91efa865d6e164ea757e7.zip
Make withMods produce Untyped trees
withMods should never be used to produce a typed tree, because typed member defs get their modifiers from their symbols.
Diffstat (limited to 'src/dotty/tools/dotc/ast/Trees.scala')
-rw-r--r--src/dotty/tools/dotc/ast/Trees.scala11
1 files changed, 4 insertions, 7 deletions
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala
index 0886a2ace..8043c2211 100644
--- a/src/dotty/tools/dotc/ast/Trees.scala
+++ b/src/dotty/tools/dotc/ast/Trees.scala
@@ -444,13 +444,13 @@ object Trees {
private[ast] def rawMods: Modifiers[T] =
if (myMods == null) genericEmptyModifiers else myMods
- def withMods(mods: Modifiers[T @uncheckedVariance]): ThisTree[T] = { // TODO move to untpd.modsDeco?
- val tree = if (myMods == null || (myMods == mods)) this else clone.asInstanceOf[MemberDef[T]]
+ def withMods(mods: Modifiers[Untyped]): ThisTree[Untyped] = {
+ val tree = if (myMods == null || (myMods == mods)) this else clone.asInstanceOf[MemberDef[Untyped]]
tree.setMods(mods)
- tree.asInstanceOf[ThisTree[T]]
+ tree.asInstanceOf[ThisTree[Untyped]]
}
- def withFlags(flags: FlagSet): ThisTree[T] = withMods(Modifiers(flags))
+ def withFlags(flags: FlagSet): ThisTree[Untyped] = withMods(Modifiers(flags))
protected def setMods(mods: Modifiers[T @uncheckedVariance]) = myMods = mods
@@ -1253,13 +1253,10 @@ object Trees {
val tpt1 = transform(tpt)
val rhs1 = transform(rhs)
cpy.ValDef(tree)(name, transform(tpt1), transform(rhs1))
- .withMods(tree.rawMods)
case tree @ DefDef(name, tparams, vparamss, tpt, rhs) =>
cpy.DefDef(tree)(name, transformSub(tparams), vparamss mapConserve (transformSub(_)), transform(tpt), transform(rhs))
- .withMods(tree.rawMods)
case tree @ TypeDef(name, rhs) =>
cpy.TypeDef(tree)(name, transform(rhs), tree.tparams)
- .withMods(tree.rawMods)
case Template(constr, parents, self, body) =>
cpy.Template(tree)(transformSub(constr), transform(parents), transformSub(self), transformStats(body))
case Import(expr, selectors) =>