Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Treat Pat.ExtractInfix like Term.ApplyInfix. Fixes #408
- Loading branch information
Showing
5 changed files
with
42 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
core/src/main/scala/org/scalafmt/util/TreeExtractors.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package org.scalafmt.util | ||
|
||
import scala.collection.immutable.Seq | ||
import scala.meta.Pat | ||
import scala.meta.Term | ||
import scala.meta.Tree | ||
|
||
object InfixApplication { | ||
def unapply(tree: Tree): Option[(Tree, Term.Name, Seq[Tree])] = tree match { | ||
case infix: Term.ApplyInfix => Some((infix.lhs, infix.op, infix.args)) | ||
case infix: Pat.ExtractInfix => Some((infix.lhs, infix.ref, infix.rhs)) | ||
case _ => None | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters