scala.meta.contrib.implicits.Equality.scala Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of scalameta_native0.5_2.13 Show documentation
Show all versions of scalameta_native0.5_2.13 Show documentation
Scalameta umbrella module that includes all public APIs
package scala.meta.contrib.implicits
import scala.meta.Tree
import scala.meta.contrib.equality.Equal
import scala.meta.contrib.equality.Structurally
import scala.meta.contrib.equality.TreeEquality
import scala.language.higherKinds
import scala.language.implicitConversions
trait Equality {
/** Helper to default tree equality to use structural equality. */
implicit def treeToContainer(tree: Tree): Structurally[Tree] = Structurally.toStructural(tree)
type Structurally[A <: Tree] = scala.meta.contrib.equality.Structurally[A]
type Syntactically[A <: Tree] = scala.meta.contrib.equality.Syntactically[A]
implicit class XtensionTreeEquality[A <: Tree](a: A) {
@inline
def isEqual[F[x <: Tree] <: TreeEquality[x]](
b: A
)(implicit conv: Tree => F[Tree], eqEv: Equal[F[Tree]]): Boolean =
(a eq b) || eqEv.isEqual(conv(a), conv(b))
}
}
object Equality extends Equality
© 2015 - 2025 Weber Informatics LLC | Privacy Policy