Skip to content

Commit

Permalink
RedundantParens: handle parens around type as well
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Jun 23, 2024
1 parent 1bcb961 commit 03244ed
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,6 +134,8 @@ class RedundantParens(implicit val ftoks: FormatTokens)
}
case pia: Member.Infix if !infixNeedsParens(pia, t) =>
okToReplaceInfix(pia, t)
case p: Tree.WithDeclTpe if p.decltpe eq t => true
case p: Tree.WithDeclTpeOpt if p.decltpe.contains(t) => true
case _ => okToReplaceOther(t)
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1449,8 +1449,8 @@ object a {
def g(h: Int): String = ???
def g(h: Int): foo.String = ???
def g(h: Int): foo.String[A] = ???
def g(h: (Int | Long)): (foo & bar) = ???
def g(h: (A & B)): (foo | bar[A]) = ???
def g(h: Int | Long): foo & bar = ???
def g(h: A & B): foo | bar[A] = ???
}
<<< type in parens, typedef
runner.dialect = scala3
Expand Down

0 comments on commit 03244ed

Please sign in to comment.