Skip to content

Commit

Permalink
forwarders to make intellij happy
Browse files Browse the repository at this point in the history
  • Loading branch information
rmgk committed Dec 17, 2024
1 parent 2614e71 commit 03a01a3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 4 deletions.
11 changes: 7 additions & 4 deletions Modules/RDTs/src/main/scala/rdts/base/Lattice.scala
Original file line number Diff line number Diff line change
Expand Up @@ -30,13 +30,13 @@ trait Lattice[A] {
* IntelliJ also does not like to implement or override extension methods. */
extension (left: A) {
/** Merging `right` into `left` has no effect */
final inline def subsumes(right: A): Boolean = Lattice.this.subsumption(right, left)
inline def subsumes(right: A): Boolean = Lattice.this.subsumption(right, left)

/** Merging `left` and `right` would be strictly larger than right */
final inline def inflates(right: A): Boolean = !Lattice.this.subsumption(left, right)
inline def inflates(right: A): Boolean = !Lattice.this.subsumption(left, right)

@targetName("mergeInfix")
final inline def merge(right: A): A = Lattice.this.merge(left, right)
inline def merge(right: A): A = Lattice.this.merge(left, right)
}
}

Expand All @@ -63,7 +63,10 @@ object Lattice {
def merge(right: A): A = Lattice[A].merge(left, right)

/** Convenience method to apply delta mutation to grow current value */
def grow(f: A => A): A = Lattice.this.merge(left, f(left))
def grow(f: A => A): A = Lattice[A].merge(left, f(left))

inline def inflates(right: A): Boolean = !Lattice.subsumption(left, right)
inline def subsumes(right: A): Boolean = Lattice.subsumption(right, left)
}

def latticeOrder[A: Lattice]: PartialOrdering[A] = new {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import rdts.dotted.Dotted
import rdts.dotted.HasDots.mapInstance
import rdts.time.{ArrayRanges, Dot, Dots}
import test.rdts.DataGenerator.{*, given}
import Lattice.syntax

import scala.annotation.tailrec

Expand Down

0 comments on commit 03a01a3

Please sign in to comment.