diff options
author | Martin Odersky <odersky@gmail.com> | 2016-09-24 16:50:58 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-09-24 16:50:58 +0200 |
commit | 331e75be7e90817bc2931c3d00dd931b22c179f5 (patch) | |
tree | e9541e8aad22f3d6f8e9b4ade3eab1ad644a46c6 /src/dotty/tools/dotc/ast/tpd.scala | |
parent | fb710457959d1c2d4b983986141875a8fde5992b (diff) | |
download | dotty-331e75be7e90817bc2931c3d00dd931b22c179f5.tar.gz dotty-331e75be7e90817bc2931c3d00dd931b22c179f5.tar.bz2 dotty-331e75be7e90817bc2931c3d00dd931b22c179f5.zip |
Swap order of elements in Annotated
Now it's annotated first, annotation second.
This is in line with AnnotatedType and in line with the principle
that tree arguments should come in the order they are written. The
reason why the order was swapped before is historical - Scala2 did it
that way.
Diffstat (limited to 'src/dotty/tools/dotc/ast/tpd.scala')
-rw-r--r-- | src/dotty/tools/dotc/ast/tpd.scala | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 5fa787b8c..022671540 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -292,8 +292,8 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { def PackageDef(pid: RefTree, stats: List[Tree])(implicit ctx: Context): PackageDef = ta.assignType(untpd.PackageDef(pid, stats), pid) - def Annotated(annot: Tree, arg: Tree)(implicit ctx: Context): Annotated = - ta.assignType(untpd.Annotated(annot, arg), annot, arg) + def Annotated(arg: Tree, annot: Tree)(implicit ctx: Context): Annotated = + ta.assignType(untpd.Annotated(arg, annot), arg, annot) def Throw(expr: Tree)(implicit ctx: Context): Tree = ref(defn.throwMethod).appliedTo(expr) @@ -568,11 +568,11 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { } } - override def Annotated(tree: Tree)(annot: Tree, arg: Tree)(implicit ctx: Context): Annotated = { - val tree1 = untpd.cpy.Annotated(tree)(annot, arg) + override def Annotated(tree: Tree)(arg: Tree, annot: Tree)(implicit ctx: Context): Annotated = { + val tree1 = untpd.cpy.Annotated(tree)(arg, annot) tree match { case tree: Annotated if (arg.tpe eq tree.arg.tpe) && (annot eq tree.annot) => tree1.withTypeUnchecked(tree.tpe) - case _ => ta.assignType(tree1, annot, arg) + case _ => ta.assignType(tree1, arg, annot) } } |