summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorDenys Shabalin <denys.shabalin@typesafe.com>2014-03-25 14:53:40 +0100
committerDenys Shabalin <denys.shabalin@typesafe.com>2014-03-25 15:43:41 +0100
commit2fea9502242265e365be987b45e130ac9669d692 (patch)
tree2cd73dbbf7d66160da96b46fc5fcf39ceed07514 /src
parent4aa58d48d27bb722290c12335da82f32021b8ede (diff)
downloadscala-2fea9502242265e365be987b45e130ac9669d692.tar.gz
scala-2fea9502242265e365be987b45e130ac9669d692.tar.bz2
scala-2fea9502242265e365be987b45e130ac9669d692.zip
SI-8350 treat single parens equivalently to no-parens in new
q"new C" and q"new C()" have identical trees after parsing. This commit adds knowledge of this invariant to SyntacticNew.
Diffstat (limited to 'src')
-rw-r--r--src/reflect/scala/reflect/internal/ReificationSupport.scala8
1 files changed, 5 insertions, 3 deletions
diff --git a/src/reflect/scala/reflect/internal/ReificationSupport.scala b/src/reflect/scala/reflect/internal/ReificationSupport.scala
index 9a130337b4..3aab3f75d4 100644
--- a/src/reflect/scala/reflect/internal/ReificationSupport.scala
+++ b/src/reflect/scala/reflect/internal/ReificationSupport.scala
@@ -510,7 +510,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) =>
@@ -829,10 +831,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)
}