From f14f5c8ce119e656f818c62ef8bcbd2490edf0fc Mon Sep 17 00:00:00 2001 From: Jason Zaugg Date: Thu, 14 May 2015 12:05:12 +1000 Subject: Remove redundant parentheses. --- src/dotty/tools/dotc/ast/Trees.scala | 18 +++++++++--------- src/dotty/tools/dotc/ast/tpd.scala | 10 +++++----- src/dotty/tools/dotc/ast/untpd.scala | 8 ++++---- 3 files changed, 18 insertions(+), 18 deletions(-) diff --git a/src/dotty/tools/dotc/ast/Trees.scala b/src/dotty/tools/dotc/ast/Trees.scala index fcb9df7fb..e668bea5e 100644 --- a/src/dotty/tools/dotc/ast/Trees.scala +++ b/src/dotty/tools/dotc/ast/Trees.scala @@ -890,7 +890,7 @@ object Trees { case tree: BackquotedIdent => if (name == tree.name) tree else finalize(tree, new BackquotedIdent(name)) - case tree: Ident if (name == tree.name) => tree + case tree: Ident if name == tree.name => tree case _ => finalize(tree, untpd.Ident(name)) } def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = tree match { @@ -901,7 +901,7 @@ object Trees { case _ => finalize(tree, untpd.Select(qualifier, name)) } def This(tree: Tree)(qual: TypeName): This = tree match { - case tree: This if (qual == tree.qual) => tree + case tree: This if qual == tree.qual => tree case _ => finalize(tree, untpd.This(qual)) } def Super(tree: Tree)(qual: Tree, mix: TypeName): Super = tree match { @@ -917,11 +917,11 @@ object Trees { case _ => finalize(tree, untpd.TypeApply(fun, args)) } def Literal(tree: Tree)(const: Constant)(implicit ctx: Context): Literal = tree match { - case tree: Literal if (const == tree.const) => tree + case tree: Literal if const == tree.const => tree case _ => finalize(tree, untpd.Literal(const)) } def New(tree: Tree)(tpt: Tree)(implicit ctx: Context): New = tree match { - case tree: New if (tpt eq tree.tpt) => tree + case tree: New if tpt eq tree.tpt => tree case _ => finalize(tree, untpd.New(tpt)) } def Pair(tree: Tree)(left: Tree, right: Tree)(implicit ctx: Context): Pair = tree match { @@ -972,7 +972,7 @@ object Trees { case tree: JavaSeqLiteral => if (elems eq tree.elems) tree else finalize(tree, new JavaSeqLiteral(elems)) - case tree: SeqLiteral if (elems eq tree.elems) => tree + case tree: SeqLiteral if elems eq tree.elems => tree case _ => finalize(tree, untpd.SeqLiteral(elems)) } def TypeTree(tree: Tree)(original: Tree): TypeTree = tree match { @@ -980,7 +980,7 @@ object Trees { case _ => finalize(tree, untpd.TypeTree(original)) } def SingletonTypeTree(tree: Tree)(ref: Tree): SingletonTypeTree = tree match { - case tree: SingletonTypeTree if (ref eq tree.ref) => tree + case tree: SingletonTypeTree if ref eq tree.ref => tree case _ => finalize(tree, untpd.SingletonTypeTree(ref)) } def SelectFromTypeTree(tree: Tree)(qualifier: Tree, name: Name): SelectFromTypeTree = tree match { @@ -1004,7 +1004,7 @@ object Trees { case _ => finalize(tree, untpd.AppliedTypeTree(tpt, args)) } def ByNameTypeTree(tree: Tree)(result: Tree): ByNameTypeTree = tree match { - case tree: ByNameTypeTree if (result eq tree.result) => tree + case tree: ByNameTypeTree if result eq tree.result => tree case _ => finalize(tree, untpd.ByNameTypeTree(result)) } def TypeBoundsTree(tree: Tree)(lo: Tree, hi: Tree): TypeBoundsTree = tree match { @@ -1016,7 +1016,7 @@ object Trees { case _ => finalize(tree, untpd.Bind(name, body)) } def Alternative(tree: Tree)(trees: List[Tree]): Alternative = tree match { - case tree: Alternative if (trees eq tree.trees) => tree + case tree: Alternative if trees eq tree.trees => tree case _ => finalize(tree, untpd.Alternative(trees)) } def UnApply(tree: Tree)(fun: Tree, implicits: List[Tree], patterns: List[Tree]): UnApply = tree match { @@ -1052,7 +1052,7 @@ object Trees { case _ => finalize(tree, untpd.Annotated(annot, arg)) } def Thicket(tree: Tree)(trees: List[Tree]): Thicket = tree match { - case tree: Thicket if (trees eq tree.trees) => tree + case tree: Thicket if trees eq tree.trees => tree case _ => finalize(tree, untpd.Thicket(trees)) } diff --git a/src/dotty/tools/dotc/ast/tpd.scala b/src/dotty/tools/dotc/ast/tpd.scala index 0468d6012..cf5ba6850 100644 --- a/src/dotty/tools/dotc/ast/tpd.scala +++ b/src/dotty/tools/dotc/ast/tpd.scala @@ -458,7 +458,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { override def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = { val tree1 = untpd.cpy.Select(tree)(qualifier, name) tree match { - case tree: Select if (qualifier.tpe eq tree.qualifier.tpe) => + case tree: Select if qualifier.tpe eq tree.qualifier.tpe => tree1.withTypeUnchecked(tree.tpe) case _ => tree.tpe match { case tpe: NamedType => tree1.withType(tpe.derivedSelect(qualifier.tpe)) @@ -504,7 +504,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { override def Block(tree: Tree)(stats: List[Tree], expr: Tree)(implicit ctx: Context): Block = { val tree1 = untpd.cpy.Block(tree)(stats, expr) tree match { - case tree: Block if (expr.tpe eq tree.expr.tpe) => tree1.withTypeUnchecked(tree.tpe) + case tree: Block if expr.tpe eq tree.expr.tpe => tree1.withTypeUnchecked(tree.tpe) case _ => ta.assignType(tree1, stats, expr) } } @@ -532,7 +532,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { override def CaseDef(tree: Tree)(pat: Tree, guard: Tree, body: Tree)(implicit ctx: Context): CaseDef = { val tree1 = untpd.cpy.CaseDef(tree)(pat, guard, body) tree match { - case tree: CaseDef if (body.tpe eq tree.body.tpe) => tree1.withTypeUnchecked(tree.tpe) + case tree: CaseDef if body.tpe eq tree.body.tpe => tree1.withTypeUnchecked(tree.tpe) case _ => ta.assignType(tree1, body) } } @@ -543,7 +543,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { override def Try(tree: Tree)(expr: Tree, cases: List[CaseDef], finalizer: Tree)(implicit ctx: Context): Try = { val tree1 = untpd.cpy.Try(tree)(expr, cases, finalizer) tree match { - case tree: Try if (expr.tpe eq tree.expr.tpe) && (sameTypes(cases, tree.cases)) => tree1.withTypeUnchecked(tree.tpe) + case tree: Try if (expr.tpe eq tree.expr.tpe) && sameTypes(cases, tree.cases) => tree1.withTypeUnchecked(tree.tpe) case _ => ta.assignType(tree1, expr, cases) } } @@ -814,7 +814,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo { expectedType match { case defn.ArrayType(el) => lastParam.tpe match { - case defn.ArrayType(el2) if (el2 <:< el) => + case defn.ArrayType(el2) if el2 <:< el => // we have a JavaSeqLiteral with a more precise type // we cannot construct a tree as JavaSeqLiteral infered to precise type // if we add typed than it would be both type-correct and diff --git a/src/dotty/tools/dotc/ast/untpd.scala b/src/dotty/tools/dotc/ast/untpd.scala index 1c1f7dd61..f009d6a86 100644 --- a/src/dotty/tools/dotc/ast/untpd.scala +++ b/src/dotty/tools/dotc/ast/untpd.scala @@ -274,7 +274,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { case _ => new PolyTypeDef(name, tparams, rhs).withPos(tree.pos) } def SymbolLit(tree: Tree)(str: String) = tree match { - case tree: SymbolLit if (str == tree.str) => tree + case tree: SymbolLit if str == tree.str => tree case _ => untpd.SymbolLit(str).withPos(tree.pos) } def InterpolatedString(tree: Tree)(id: TermName, strings: List[Literal], elems: List[Tree]) = tree match { @@ -298,15 +298,15 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo { case _ => untpd.PrefixOp(op, od).withPos(tree.pos) } def Parens(tree: Tree)(t: Tree) = tree match { - case tree: Parens if (t eq tree.t) => tree + case tree: Parens if t eq tree.t => tree case _ => untpd.Parens(t).withPos(tree.pos) } def Tuple(tree: Tree)(trees: List[Tree]) = tree match { - case tree: Tuple if (trees eq tree.trees) => tree + case tree: Tuple if trees eq tree.trees => tree case _ => untpd.Tuple(trees).withPos(tree.pos) } def Throw(tree: Tree)(expr: Tree) = tree match { - case tree: Throw if (expr eq tree.expr) => tree + case tree: Throw if expr eq tree.expr => tree case _ => untpd.Throw(expr).withPos(tree.pos) } def WhileDo(tree: Tree)(cond: Tree, body: Tree) = tree match { -- cgit v1.2.3