Skip to content

Commit f14f5c8

Browse files
committed
Remove redundant parentheses.
1 parent b6b1fb3 commit f14f5c8

File tree

3 files changed

+18
-18
lines changed

3 files changed

+18
-18
lines changed

src/dotty/tools/dotc/ast/Trees.scala

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -890,7 +890,7 @@ object Trees {
890890
case tree: BackquotedIdent =>
891891
if (name == tree.name) tree
892892
else finalize(tree, new BackquotedIdent(name))
893-
case tree: Ident if (name == tree.name) => tree
893+
case tree: Ident if name == tree.name => tree
894894
case _ => finalize(tree, untpd.Ident(name))
895895
}
896896
def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = tree match {
@@ -901,7 +901,7 @@ object Trees {
901901
case _ => finalize(tree, untpd.Select(qualifier, name))
902902
}
903903
def This(tree: Tree)(qual: TypeName): This = tree match {
904-
case tree: This if (qual == tree.qual) => tree
904+
case tree: This if qual == tree.qual => tree
905905
case _ => finalize(tree, untpd.This(qual))
906906
}
907907
def Super(tree: Tree)(qual: Tree, mix: TypeName): Super = tree match {
@@ -917,11 +917,11 @@ object Trees {
917917
case _ => finalize(tree, untpd.TypeApply(fun, args))
918918
}
919919
def Literal(tree: Tree)(const: Constant)(implicit ctx: Context): Literal = tree match {
920-
case tree: Literal if (const == tree.const) => tree
920+
case tree: Literal if const == tree.const => tree
921921
case _ => finalize(tree, untpd.Literal(const))
922922
}
923923
def New(tree: Tree)(tpt: Tree)(implicit ctx: Context): New = tree match {
924-
case tree: New if (tpt eq tree.tpt) => tree
924+
case tree: New if tpt eq tree.tpt => tree
925925
case _ => finalize(tree, untpd.New(tpt))
926926
}
927927
def Pair(tree: Tree)(left: Tree, right: Tree)(implicit ctx: Context): Pair = tree match {
@@ -972,15 +972,15 @@ object Trees {
972972
case tree: JavaSeqLiteral =>
973973
if (elems eq tree.elems) tree
974974
else finalize(tree, new JavaSeqLiteral(elems))
975-
case tree: SeqLiteral if (elems eq tree.elems) => tree
975+
case tree: SeqLiteral if elems eq tree.elems => tree
976976
case _ => finalize(tree, untpd.SeqLiteral(elems))
977977
}
978978
def TypeTree(tree: Tree)(original: Tree): TypeTree = tree match {
979979
case tree: TypeTree if original eq tree.original => tree
980980
case _ => finalize(tree, untpd.TypeTree(original))
981981
}
982982
def SingletonTypeTree(tree: Tree)(ref: Tree): SingletonTypeTree = tree match {
983-
case tree: SingletonTypeTree if (ref eq tree.ref) => tree
983+
case tree: SingletonTypeTree if ref eq tree.ref => tree
984984
case _ => finalize(tree, untpd.SingletonTypeTree(ref))
985985
}
986986
def SelectFromTypeTree(tree: Tree)(qualifier: Tree, name: Name): SelectFromTypeTree = tree match {
@@ -1004,7 +1004,7 @@ object Trees {
10041004
case _ => finalize(tree, untpd.AppliedTypeTree(tpt, args))
10051005
}
10061006
def ByNameTypeTree(tree: Tree)(result: Tree): ByNameTypeTree = tree match {
1007-
case tree: ByNameTypeTree if (result eq tree.result) => tree
1007+
case tree: ByNameTypeTree if result eq tree.result => tree
10081008
case _ => finalize(tree, untpd.ByNameTypeTree(result))
10091009
}
10101010
def TypeBoundsTree(tree: Tree)(lo: Tree, hi: Tree): TypeBoundsTree = tree match {
@@ -1016,7 +1016,7 @@ object Trees {
10161016
case _ => finalize(tree, untpd.Bind(name, body))
10171017
}
10181018
def Alternative(tree: Tree)(trees: List[Tree]): Alternative = tree match {
1019-
case tree: Alternative if (trees eq tree.trees) => tree
1019+
case tree: Alternative if trees eq tree.trees => tree
10201020
case _ => finalize(tree, untpd.Alternative(trees))
10211021
}
10221022
def UnApply(tree: Tree)(fun: Tree, implicits: List[Tree], patterns: List[Tree]): UnApply = tree match {
@@ -1052,7 +1052,7 @@ object Trees {
10521052
case _ => finalize(tree, untpd.Annotated(annot, arg))
10531053
}
10541054
def Thicket(tree: Tree)(trees: List[Tree]): Thicket = tree match {
1055-
case tree: Thicket if (trees eq tree.trees) => tree
1055+
case tree: Thicket if trees eq tree.trees => tree
10561056
case _ => finalize(tree, untpd.Thicket(trees))
10571057
}
10581058

src/dotty/tools/dotc/ast/tpd.scala

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -458,7 +458,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
458458
override def Select(tree: Tree)(qualifier: Tree, name: Name)(implicit ctx: Context): Select = {
459459
val tree1 = untpd.cpy.Select(tree)(qualifier, name)
460460
tree match {
461-
case tree: Select if (qualifier.tpe eq tree.qualifier.tpe) =>
461+
case tree: Select if qualifier.tpe eq tree.qualifier.tpe =>
462462
tree1.withTypeUnchecked(tree.tpe)
463463
case _ => tree.tpe match {
464464
case tpe: NamedType => tree1.withType(tpe.derivedSelect(qualifier.tpe))
@@ -504,7 +504,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
504504
override def Block(tree: Tree)(stats: List[Tree], expr: Tree)(implicit ctx: Context): Block = {
505505
val tree1 = untpd.cpy.Block(tree)(stats, expr)
506506
tree match {
507-
case tree: Block if (expr.tpe eq tree.expr.tpe) => tree1.withTypeUnchecked(tree.tpe)
507+
case tree: Block if expr.tpe eq tree.expr.tpe => tree1.withTypeUnchecked(tree.tpe)
508508
case _ => ta.assignType(tree1, stats, expr)
509509
}
510510
}
@@ -532,7 +532,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
532532
override def CaseDef(tree: Tree)(pat: Tree, guard: Tree, body: Tree)(implicit ctx: Context): CaseDef = {
533533
val tree1 = untpd.cpy.CaseDef(tree)(pat, guard, body)
534534
tree match {
535-
case tree: CaseDef if (body.tpe eq tree.body.tpe) => tree1.withTypeUnchecked(tree.tpe)
535+
case tree: CaseDef if body.tpe eq tree.body.tpe => tree1.withTypeUnchecked(tree.tpe)
536536
case _ => ta.assignType(tree1, body)
537537
}
538538
}
@@ -543,7 +543,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
543543
override def Try(tree: Tree)(expr: Tree, cases: List[CaseDef], finalizer: Tree)(implicit ctx: Context): Try = {
544544
val tree1 = untpd.cpy.Try(tree)(expr, cases, finalizer)
545545
tree match {
546-
case tree: Try if (expr.tpe eq tree.expr.tpe) && (sameTypes(cases, tree.cases)) => tree1.withTypeUnchecked(tree.tpe)
546+
case tree: Try if (expr.tpe eq tree.expr.tpe) && sameTypes(cases, tree.cases) => tree1.withTypeUnchecked(tree.tpe)
547547
case _ => ta.assignType(tree1, expr, cases)
548548
}
549549
}
@@ -814,7 +814,7 @@ object tpd extends Trees.Instance[Type] with TypedTreeInfo {
814814
expectedType match {
815815
case defn.ArrayType(el) =>
816816
lastParam.tpe match {
817-
case defn.ArrayType(el2) if (el2 <:< el) =>
817+
case defn.ArrayType(el2) if el2 <:< el =>
818818
// we have a JavaSeqLiteral with a more precise type
819819
// we cannot construct a tree as JavaSeqLiteral infered to precise type
820820
// if we add typed than it would be both type-correct and

src/dotty/tools/dotc/ast/untpd.scala

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -274,7 +274,7 @@ object untpd extends Trees.Instance[Untyped] with UntypedTreeInfo {
274274
case _ => new PolyTypeDef(name, tparams, rhs).withPos(tree.pos)
275275
}
276276
def SymbolLit(tree: Tree)(str: String) = tree match {
277-
case tree: SymbolLit if (str == tree.str) => tree
277+
case tree: SymbolLit if str == tree.str => tree
278278
case _ => untpd.SymbolLit(str).withPos(tree.pos)
279279
}
280280
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 {
298298
case _ => untpd.PrefixOp(op, od).withPos(tree.pos)
299299
}
300300
def Parens(tree: Tree)(t: Tree) = tree match {
301-
case tree: Parens if (t eq tree.t) => tree
301+
case tree: Parens if t eq tree.t => tree
302302
case _ => untpd.Parens(t).withPos(tree.pos)
303303
}
304304
def Tuple(tree: Tree)(trees: List[Tree]) = tree match {
305-
case tree: Tuple if (trees eq tree.trees) => tree
305+
case tree: Tuple if trees eq tree.trees => tree
306306
case _ => untpd.Tuple(trees).withPos(tree.pos)
307307
}
308308
def Throw(tree: Tree)(expr: Tree) = tree match {
309-
case tree: Throw if (expr eq tree.expr) => tree
309+
case tree: Throw if expr eq tree.expr => tree
310310
case _ => untpd.Throw(expr).withPos(tree.pos)
311311
}
312312
def WhileDo(tree: Tree)(cond: Tree, body: Tree) = tree match {

0 commit comments

Comments
 (0)