Skip to content

Commit

Permalink
TreeOps: remove isDefDef, use Member.ParamClause
Browse files Browse the repository at this point in the history
  • Loading branch information
kitbellew committed Aug 12, 2023
1 parent 77cb5c2 commit f79d970
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -679,9 +679,13 @@ class Router(formatOps: FormatOps) {
// https://github.com/scalameta/scalafmt/pull/1516
// https://github.com/scalameta/scalafmt/issues/1528
case t: Init => t.parent.forall(_.is[Mod.Annot])
case t @ Term.Name(name) if isSymbolicName(name) =>
case Term.Name(name) =>
style.spaces.afterTripleEquals && name == "===" ||
style.spaces.afterSymbolicDefs && t.parent.exists(isDefDef)
(rightOwner match {
case _: Member.ParamClause =>
style.spaces.afterSymbolicDefs && isSymbolicName(name)
case _ => false
})
case _: Defn.ExtensionGroup =>
style.spaces.afterKeywordBeforeParen && left.is[soft.KwExtension]
case _ => false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,12 +323,6 @@ object TreeOps {
)(implicit classifier: Classifier[Tree, A]): Boolean =
findTreeWithParentOfType[A](tree).isDefined

def isDefDef(tree: Tree): Boolean =
tree match {
case _: Decl.Def | _: Defn.Def | _: Defn.Macro => true
case _ => false
}

@tailrec
def defDefBody(tree: Tree): Option[Tree] =
tree match {
Expand Down

0 comments on commit f79d970

Please sign in to comment.