summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJason Zaugg <jzaugg@gmail.com>2014-03-27 21:02:40 +0100
committerJason Zaugg <jzaugg@gmail.com>2014-03-27 21:02:40 +0100
commit1ced55f76a8de60a02428d3d7f1e1a44a0f61ab7 (patch)
tree8cfcb9d896169462c8fcbe1cd75a7f9960e036df /src
parent26419257cc0b1b37e0130dacde63715340306c1c (diff)
parentf10d7541c9c2ddbb3a9cd1a1db800a2fef5a9082 (diff)
downloadscala-1ced55f76a8de60a02428d3d7f1e1a44a0f61ab7.tar.gz
scala-1ced55f76a8de60a02428d3d7f1e1a44a0f61ab7.tar.bz2
scala-1ced55f76a8de60a02428d3d7f1e1a44a0f61ab7.zip
Merge pull request #3656 from densh/si/8387-8350
SI-8350 SI-8387 tweak handling of new trees
Diffstat (limited to 'src')
-rw-r--r--src/reflect/scala/reflect/internal/ReificationSupport.scala21
1 files changed, 14 insertions, 7 deletions
diff --git a/src/reflect/scala/reflect/internal/ReificationSupport.scala b/src/reflect/scala/reflect/internal/ReificationSupport.scala
index 37f7b85720..8379ff1ec8 100644
--- a/src/reflect/scala/reflect/internal/ReificationSupport.scala
+++ b/src/reflect/scala/reflect/internal/ReificationSupport.scala
@@ -241,10 +241,15 @@ trait ReificationSupport { self: SymbolTable =>
case UnApply(treeInfo.Unapplied(Select(fun, nme.unapply)), pats) =>
Some((fun, pats :: Nil))
case treeInfo.Applied(fun, targs, argss) =>
- val callee =
- if (fun.isTerm) SyntacticTypeApplied(fun, targs)
- else SyntacticAppliedType(fun, targs)
- Some((callee, argss))
+ fun match {
+ case Select(_: New, nme.CONSTRUCTOR) =>
+ Some((tree, Nil))
+ case _ =>
+ val callee =
+ if (fun.isTerm) SyntacticTypeApplied(fun, targs)
+ else SyntacticAppliedType(fun, targs)
+ Some((callee, argss))
+ }
}
}
@@ -510,7 +515,9 @@ trait ReificationSupport { self: SymbolTable =>
gen.mkNew(parents, mkSelfType(selfType), earlyDefs ::: body, NoPosition, NoPosition)
def unapply(tree: Tree): Option[(List[Tree], List[Tree], ValDef, List[Tree])] = tree match {
- case SyntacticApplied(Select(New(SyntacticAppliedType(ident, targs)), nme.CONSTRUCTOR), argss) =>
+ case treeInfo.Applied(Select(New(SyntacticAppliedType(ident, targs)), nme.CONSTRUCTOR), Nil, List(Nil)) =>
+ Some((Nil, SyntacticAppliedType(ident, targs) :: Nil, noSelfType, Nil))
+ case treeInfo.Applied(Select(New(SyntacticAppliedType(ident, targs)), nme.CONSTRUCTOR), Nil, argss) =>
Some((Nil, SyntacticApplied(SyntacticAppliedType(ident, targs), argss) :: Nil, noSelfType, Nil))
case SyntacticBlock(SyntacticClassDef(_, tpnme.ANON_CLASS_NAME, Nil, _, ListOfNil, earlyDefs, parents, selfType, body) ::
Apply(Select(New(Ident(tpnme.ANON_CLASS_NAME)), nme.CONSTRUCTOR), Nil) :: Nil) =>
@@ -839,10 +846,10 @@ trait ReificationSupport { self: SymbolTable =>
// drop potential @scala.unchecked annotation
protected object MaybeUnchecked {
def unapply(tree: Tree): Some[Tree] = tree match {
- case Annotated(SyntacticNew(Nil, Apply(ScalaDot(tpnme.unchecked), Nil) :: Nil, noSelfType, Nil), annottee) =>
+ case Annotated(SyntacticNew(Nil, ScalaDot(tpnme.unchecked) :: Nil, noSelfType, Nil), annottee) =>
Some(annottee)
case Typed(annottee, MaybeTypeTreeOriginal(
- Annotated(SyntacticNew(Nil, Apply(ScalaDot(tpnme.unchecked), Nil) :: Nil, noSelfType, Nil), _))) =>
+ Annotated(SyntacticNew(Nil, ScalaDot(tpnme.unchecked) :: Nil, noSelfType, Nil), _))) =>
Some(annottee)
case annottee => Some(annottee)
}