aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/dotty/tools/dotc/ast/Desugar.scala4
-rw-r--r--src/dotty/tools/dotc/ast/Trees.scala78
-rw-r--r--src/dotty/tools/dotc/transform/Nullarify.scala2
-rw-r--r--src/dotty/tools/dotc/transform/UncurryTreeTransform.scala2
-rw-r--r--src/dotty/tools/dotc/typer/ReTyper.scala6
5 files changed, 46 insertions, 46 deletions
diff --git a/src/dotty/tools/dotc/ast/Desugar.scala b/src/dotty/tools/dotc/ast/Desugar.scala
index fcaef9730..cfb9c338f 100644
--- a/src/dotty/tools/dotc/ast/Desugar.scala
+++ b/src/dotty/tools/dotc/ast/Desugar.scala
@@ -504,8 +504,8 @@ object desugar {
*/
def block(tree: Block)(implicit ctx: Context): Block = tree.expr match {
case EmptyTree =>
- cpy.Block(tree)(
- expr = unitLiteral withPos (if (tree.stats.isEmpty) tree.pos else tree.pos.endPos))
+ cpy.Block(tree)(tree.stats,
+ unitLiteral withPos (if (tree.stats.isEmpty) tree.pos else tree.pos.endPos))
case _ =>
tree
}
diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala
index 3ff600f44..b28cb87e6 100644
--- a/src/dotty/tools/dotc/ast/Trees.scala
+++ b/src/dotty/tools/dotc/ast/Trees.scala
@@ -433,7 +433,7 @@ object Trees {
case class Select[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name)
extends RefTree[T] {
type ThisTree[-T >: Untyped] = Select[T]
- def withName(name: Name)(implicit ctx: Context): untpd.Select = untpd.cpy.Select(this)(name = name)
+ def withName(name: Name)(implicit ctx: Context): untpd.Select = untpd.cpy.Select(this)(qualifier, name)
}
class SelectWithSig[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name, val sig: Signature)
@@ -620,7 +620,7 @@ object Trees {
case class SelectFromTypeTree[-T >: Untyped] private[ast] (qualifier: Tree[T], name: Name)
extends RefTree[T] {
type ThisTree[-T >: Untyped] = SelectFromTypeTree[T]
- def withName(name: Name)(implicit ctx: Context): untpd.SelectFromTypeTree = untpd.cpy.SelectFromTypeTree(this)(name = name)
+ def withName(name: Name)(implicit ctx: Context): untpd.SelectFromTypeTree = untpd.cpy.SelectFromTypeTree(this)(qualifier, name)
}
/** left & right */
@@ -666,7 +666,7 @@ object Trees {
extends NameTree[T] with DefTree[T] with PatternTree[T] {
type ThisTree[-T >: Untyped] = Bind[T]
override def envelope: Position = pos union initialPos
- def withName(name: Name)(implicit ctx: Context): untpd.Bind = untpd.cpy.Bind(this)(name = name)
+ def withName(name: Name)(implicit ctx: Context): untpd.Bind = untpd.cpy.Bind(this)(name, body)
}
/** tree_1 | ... | tree_n */
@@ -1094,24 +1094,24 @@ object Trees {
}
// Copier methods with default arguments; these demand that the original tree
- // is of the same class as the copy
-
- def Select(tree: Select)(qualifier: Tree = tree.qualifier, name: Name = tree.name): Select =
- Select(tree: Tree)(qualifier, name)
- def Super(tree: Super)(qual: Tree = tree.qual, mix: TypeName = tree.mix): Super =
- Super(tree: Tree)(qual, mix)
- def Apply(tree: Apply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): Apply =
- Apply(tree: Tree)(fun, args)
- def TypeApply(tree: TypeApply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): TypeApply =
- TypeApply(tree: Tree)(fun, args)
- def Typed(tree: Typed)(expr: Tree = tree.expr, tpt: Tree = tree.tpt): Typed =
- Typed(tree: Tree)(expr, tpt)
- def NamedArg(tree: NamedArg)(name: Name = tree.name, arg: Tree = tree.arg): NamedArg =
- NamedArg(tree: Tree)(name, arg)
- def Assign(tree: Assign)(lhs: Tree = tree.lhs, rhs: Tree = tree.rhs): Assign =
- Assign(tree: Tree)(lhs, rhs)
- def Block(tree: Block)(stats: List[Tree] = tree.stats, expr: Tree = tree.expr): Block =
- Block(tree: Tree)(stats, expr)
+ // is of the same class as the copy. We only include trees with more than 2 elements here.
+
+ //def Select(tree: Select)(qualifier: Tree = tree.qualifier, name: Name = tree.name): Select =
+ // Select(tree: Tree)(qualifier, name)
+ //def Super(tree: Super)(qual: Tree = tree.qual, mix: TypeName = tree.mix): Super =
+ // Super(tree: Tree)(qual, mix)
+ //def Apply(tree: Apply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): Apply =
+ // Apply(tree: Tree)(fun, args)
+ //def TypeApply(tree: TypeApply)(fun: Tree = tree.fun, args: List[Tree] = tree.args): TypeApply =
+ // TypeApply(tree: Tree)(fun, args)
+ //def Typed(tree: Typed)(expr: Tree = tree.expr, tpt: Tree = tree.tpt): Typed =
+ // Typed(tree: Tree)(expr, tpt)
+ //def NamedArg(tree: NamedArg)(name: Name = tree.name, arg: Tree = tree.arg): NamedArg =
+ // NamedArg(tree: Tree)(name, arg)
+ //def Assign(tree: Assign)(lhs: Tree = tree.lhs, rhs: Tree = tree.rhs): Assign =
+ // Assign(tree: Tree)(lhs, rhs)
+ //def Block(tree: Block)(stats: List[Tree] = tree.stats, expr: Tree = tree.expr): Block =
+ // Block(tree: Tree)(stats, expr)
def If(tree: If)(cond: Tree = tree.cond, thenp: Tree = tree.thenp, elsep: Tree = tree.elsep): If =
If(tree: Tree)(cond, thenp, elsep)
def Closure(tree: Closure)(env: List[Tree] = tree.env, meth: Tree = tree.meth, tpt: Tree = tree.tpt): Closure =
@@ -1120,20 +1120,20 @@ object Trees {
Match(tree: Tree)(selector, cases)
def CaseDef(tree: CaseDef)(pat: Tree = tree.pat, guard: Tree = tree.guard, body: Tree = tree.body): CaseDef =
CaseDef(tree: Tree)(pat, guard, body)
- def Return(tree: Return)(expr: Tree = tree.expr, from: Tree = tree.from): Return =
- Return(tree: Tree)(expr, from)
+ //def Return(tree: Return)(expr: Tree = tree.expr, from: Tree = tree.from): Return =
+ // Return(tree: Tree)(expr, from)
def Try(tree: Try)(expr: Tree = tree.expr, handler: Tree = tree.handler, finalizer: Tree = tree.finalizer): Try =
Try(tree: Tree)(expr, handler, finalizer)
- def SelectFromTypeTree(tree: SelectFromTypeTree)(qualifier: Tree = tree.qualifier, name: Name = tree.name):
- SelectFromTypeTree = SelectFromTypeTree(tree: Tree)(qualifier, name)
- def RefinedTypeTree(tree: RefinedTypeTree)(tpt: Tree = tree.tpt, refinements: List[Tree] = tree.refinements):
- RefinedTypeTree = RefinedTypeTree(tree: Tree)(tpt, refinements)
- def AppliedTypeTree(tree: AppliedTypeTree)(tpt: Tree = tree.tpt, args: List[Tree] = tree.args): AppliedTypeTree =
- AppliedTypeTree(tree: Tree)(tpt, args)
- def TypeBoundsTree(tree: TypeBoundsTree)(lo: Tree = tree.lo, hi: Tree = tree.hi): TypeBoundsTree =
- TypeBoundsTree(tree: Tree)(lo, hi)
- def Bind(tree: Bind)(name: Name = tree.name, body: Tree = tree.body): Bind =
- Bind(tree: Tree)(name, body)
+ //def SelectFromTypeTree(tree: SelectFromTypeTree)(qualifier: Tree = tree.qualifier, name: Name = tree.name):
+ // SelectFromTypeTree = SelectFromTypeTree(tree: Tree)(qualifier, name)
+ //def RefinedTypeTree(tree: RefinedTypeTree)(tpt: Tree = tree.tpt, refinements: List[Tree] = tree.refinements):
+ // RefinedTypeTree = RefinedTypeTree(tree: Tree)(tpt, refinements)
+ //def AppliedTypeTree(tree: AppliedTypeTree)(tpt: Tree = tree.tpt, args: List[Tree] = tree.args): AppliedTypeTree =
+ // AppliedTypeTree(tree: Tree)(tpt, args)
+ //def TypeBoundsTree(tree: TypeBoundsTree)(lo: Tree = tree.lo, hi: Tree = tree.hi): TypeBoundsTree =
+ // TypeBoundsTree(tree: Tree)(lo, hi)
+ //def Bind(tree: Bind)(name: Name = tree.name, body: Tree = tree.body): Bind =
+ // Bind(tree: Tree)(name, body)
def UnApply(tree: UnApply)(fun: Tree = tree.fun, implicits: List[Tree] = tree.implicits, patterns: List[Tree] = tree.patterns): UnApply =
UnApply(tree: Tree)(fun, implicits, patterns)
def ValDef(tree: ValDef)(mods: Modifiers = tree.mods, name: TermName = tree.name, tpt: Tree = tree.tpt, rhs: Tree = tree.rhs): ValDef =
@@ -1144,12 +1144,12 @@ object Trees {
TypeDef(tree: Tree)(mods, name, rhs, tparams)
def Template(tree: Template)(constr: DefDef = tree.constr, parents: List[Tree] = tree.parents, self: ValDef = tree.self, body: List[Tree] = tree.body): Template =
Template(tree: Tree)(constr, parents, self, body)
- def Import(tree: Import)(expr: Tree = tree.expr, selectors: List[untpd.Tree] = tree.selectors): Import =
- Import(tree: Tree)(expr, selectors)
- def PackageDef(tree: PackageDef)(pid: RefTree = tree.pid, stats: List[Tree] = tree.stats): PackageDef =
- PackageDef(tree: Tree)(pid, stats)
- def Annotated(tree: Annotated)(annot: Tree = tree.annot, arg: Tree = tree.arg): Annotated =
- Annotated(tree: Tree)(annot, arg)
+ //def Import(tree: Import)(expr: Tree = tree.expr, selectors: List[untpd.Tree] = tree.selectors): Import =
+ // Import(tree: Tree)(expr, selectors)
+ //def PackageDef(tree: PackageDef)(pid: RefTree = tree.pid, stats: List[Tree] = tree.stats): PackageDef =
+ // PackageDef(tree: Tree)(pid, stats)
+ //def Annotated(tree: Annotated)(annot: Tree = tree.annot, arg: Tree = tree.arg): Annotated =
+ // Annotated(tree: Tree)(annot, arg)
}
abstract class TreeMap(val cpy: TreeCopier = inst.cpy) {
diff --git a/src/dotty/tools/dotc/transform/Nullarify.scala b/src/dotty/tools/dotc/transform/Nullarify.scala
index 7cca19e5a..554a51efb 100644
--- a/src/dotty/tools/dotc/transform/Nullarify.scala
+++ b/src/dotty/tools/dotc/transform/Nullarify.scala
@@ -72,7 +72,7 @@ class Nullarify extends MiniPhaseTransform with InfoTransformer {
val MethodType(_, formals) = methType(funType, tree.fun)
val args1 = tree.args.zipWithConserve(formals)(transformArg)
- cpy.Apply(tree)(args = args1) withType nullarify(tree.tpe)
+ cpy.Apply(tree)(tree.fun, args1) withType nullarify(tree.tpe)
}
/** Insert () or .apply() if the term refers to something that was converted to a
diff --git a/src/dotty/tools/dotc/transform/UncurryTreeTransform.scala b/src/dotty/tools/dotc/transform/UncurryTreeTransform.scala
index c713a7d30..cf7668079 100644
--- a/src/dotty/tools/dotc/transform/UncurryTreeTransform.scala
+++ b/src/dotty/tools/dotc/transform/UncurryTreeTransform.scala
@@ -23,7 +23,7 @@ class UncurryTreeTransform extends MiniPhaseTransform with InfoTransformer {
showType
ctx.atNextPhase(showType(_))
showType
- cpy.Apply(tree)(args = args ++ tree.args)
+ cpy.Apply(tree)(tree.fun, args ++ tree.args)
case _ => tree
}}
diff --git a/src/dotty/tools/dotc/typer/ReTyper.scala b/src/dotty/tools/dotc/typer/ReTyper.scala
index 42128f67f..dbf353f9e 100644
--- a/src/dotty/tools/dotc/typer/ReTyper.scala
+++ b/src/dotty/tools/dotc/typer/ReTyper.scala
@@ -32,13 +32,13 @@ class ReTyper extends Typer {
override def typedSelect(tree: untpd.Select, pt: Type)(implicit ctx: Context): Tree = {
assert(tree.hasType)
val qual1 = typed(tree.qualifier, AnySelectionProto)
- untpd.cpy.Select(tree)(qualifier = qual1).withType(tree.typeOpt)
+ untpd.cpy.Select(tree)(qual1, tree.name).withType(tree.typeOpt)
}
override def typedSelectFromTypeTree(tree: untpd.SelectFromTypeTree, pt: Type)(implicit ctx: Context): SelectFromTypeTree = {
assert(tree.hasType)
val qual1 = typed(tree.qualifier, AnySelectionProto)
- untpd.cpy.SelectFromTypeTree(tree)(qualifier = qual1).withType(tree.typeOpt)
+ untpd.cpy.SelectFromTypeTree(tree)(qual1, tree.name).withType(tree.typeOpt)
}
override def typedLiteral(tree: untpd.Literal)(implicit ctc: Context): Literal =
@@ -50,7 +50,7 @@ class ReTyper extends Typer {
override def typedBind(tree: untpd.Bind, pt: Type)(implicit ctx: Context): Bind = {
assert(tree.hasType)
val body1 = typed(tree.body, pt)
- untpd.cpy.Bind(tree)(body = body1).withType(tree.typeOpt)
+ untpd.cpy.Bind(tree)(tree.name, body1).withType(tree.typeOpt)
}
override def localDummy(cls: ClassSymbol, impl: untpd.Template)(implicit ctx: Context) = impl.symbol