aboutsummaryrefslogtreecommitdiff
path: root/src/dotty/tools/dotc/typer/Applications.scala
diff options
context:
space:
mode:
authorMartin Odersky <odersky@gmail.com>2014-07-06 18:26:24 +0200
committerMartin Odersky <odersky@gmail.com>2014-08-13 14:54:05 +0200
commita878d19e48455ca600f3fbe6e36c6ddd687e14ff (patch)
tree624773cda76db0702fc9b3ca3dcdd338f8177c49 /src/dotty/tools/dotc/typer/Applications.scala
parent34f73ded3519a1df7d278685f3f33facd00f1c58 (diff)
downloaddotty-a878d19e48455ca600f3fbe6e36c6ddd687e14ff.tar.gz
dotty-a878d19e48455ca600f3fbe6e36c6ddd687e14ff.tar.bz2
dotty-a878d19e48455ca600f3fbe6e36c6ddd687e14ff.zip
Changes to tree copying
1) Add copiers with default arguments, to avoid boilerplate 2) All copiers are now curried wrt first argument (which is the original tree). We already make use of the new features in cpy.DefDef, but not yet elsewhere.
Diffstat (limited to 'src/dotty/tools/dotc/typer/Applications.scala')
-rw-r--r--src/dotty/tools/dotc/typer/Applications.scala12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/dotty/tools/dotc/typer/Applications.scala b/src/dotty/tools/dotc/typer/Applications.scala
index 0991bf4a8..86327d2fc 100644
--- a/src/dotty/tools/dotc/typer/Applications.scala
+++ b/src/dotty/tools/dotc/typer/Applications.scala
@@ -404,7 +404,7 @@ trait Applications extends Compatibility { self: Typer =>
val result = {
var typedArgs = typedArgBuf.toList
- val app0 = cpy.Apply(app, normalizedFun, typedArgs)
+ val app0 = cpy.Apply(app)(normalizedFun, typedArgs)
val app1 =
if (!success) app0.withType(ErrorType)
else {
@@ -470,7 +470,7 @@ trait Applications extends Compatibility { self: Typer =>
failedState.commit()
failedVal
} else typedApply(
- cpy.Apply(tree, untpd.TypedSplice(fun2), proto.typedArgs map untpd.TypedSplice), pt)
+ cpy.Apply(tree)(untpd.TypedSplice(fun2), proto.typedArgs map untpd.TypedSplice), pt)
}
case _ =>
fun1.tpe match {
@@ -527,7 +527,7 @@ trait Applications extends Compatibility { self: Typer =>
checkBounds(typedArgs, pt, tree.pos)
case _ =>
}
- assignType(cpy.TypeApply(tree, typedFn, typedArgs), typedFn, typedArgs)
+ assignType(cpy.TypeApply(tree)(typedFn, typedArgs), typedFn, typedArgs)
}
def typedUnApply(tree: untpd.Apply, pt: Type)(implicit ctx: Context): Tree = track("typedUnApply") {
@@ -712,14 +712,14 @@ trait Applications extends Compatibility { self: Typer =>
List.fill(argTypes.length - args.length)(WildcardType)
}
val unapplyPatterns = (bunchedArgs, argTypes).zipped map (typed(_, _))
- val result = assignType(cpy.UnApply(tree, unapplyFn, unapplyImplicits, unapplyPatterns), ownType)
+ val result = assignType(cpy.UnApply(tree)(unapplyFn, unapplyImplicits, unapplyPatterns), ownType)
unapp.println(s"unapply patterns = $unapplyPatterns")
if ((ownType eq pt) || ownType.isError) result
else Typed(result, TypeTree(ownType))
case tp =>
val unapplyErr = if (tp.isError) unapplyFn else notAnExtractor(unapplyFn)
val typedArgsErr = args mapconserve (typed(_, defn.AnyType))
- cpy.UnApply(tree, unapplyErr, Nil, typedArgsErr) withType ErrorType
+ cpy.UnApply(tree)(unapplyErr, Nil, typedArgsErr) withType ErrorType
}
}
@@ -881,7 +881,7 @@ trait Applications extends Compatibility { self: Typer =>
def treeShape(tree: untpd.Tree): Tree = tree match {
case NamedArg(name, arg) =>
val argShape = treeShape(arg)
- cpy.NamedArg(tree, name, argShape).withType(argShape.tpe)
+ cpy.NamedArg(tree)(name, argShape).withType(argShape.tpe)
case _ =>
dummyTreeOfType(typeShape(tree))
}