Skip to content

Commit 60de259

Browse files
committed
replace experimental syntax with minor workaround
1 parent 7d6f94f commit 60de259

File tree

2 files changed

+6
-7
lines changed

2 files changed

+6
-7
lines changed

Modules/RDTs/src/main/scala/rdts/base/Lattice.scala

+5-5
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ object Lattice {
5050
/** Some types have multiple structural representations for semantically the same value, e.g., they may contain redundant or replaced parts. This can lead to semantically equivalent values that are not structurally equal. Normalize tries to fix this. */
5151
def normalize[A: Lattice](v: A): A = v `merge` v
5252

53-
def diff[A: {Lattice, Decompose}](state: A, delta: A): Option[A] = {
53+
def diff[A: {Lattice as A, Decompose}](state: A, delta: A): Option[A] = {
5454
delta.decomposed.filter(!A.subsumption(_, state)).reduceOption(merge)
5555
}
5656

@@ -59,17 +59,17 @@ object Lattice {
5959
// Thus, we put the extension into this implicit object, when `Lattice.syntax` is imported (or otherwise in the implicit scope) then it is eligible as the receiver for the extension method rewrite. For some reason, this never causes conflicts even if multiple objects are named `syntax` (as opposed to name conflicts with the extension method, which does cause conflicts).
6060
// also, intellij does find these, but not the ones on the trait … ?
6161
given syntax: {} with
62-
extension [A: Lattice](left: A) {
63-
def merge(right: A): A = Lattice[A].merge(left, right)
62+
extension [A: Lattice as A](left: A) {
63+
def merge(right: A): A = A.merge(left, right)
6464

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

6868
inline def inflates(right: A): Boolean = !A.subsumption(left, right)
6969
inline def subsumes(right: A): Boolean = A.subsumption(right, left)
7070
}
7171

72-
def latticeOrder[A: Lattice]: PartialOrdering[A] = new {
72+
def latticeOrder[A: Lattice as A]: PartialOrdering[A] = new {
7373
override def lteq(x: A, y: A): Boolean = A.subsumption(x, y)
7474
override def tryCompare(x: A, y: A): Option[Int] =
7575
val lr = lteq(x, y)

project/Settings.scala

+1-2
Original file line numberDiff line numberDiff line change
@@ -28,13 +28,12 @@ object Settings {
2828
valueDiscard(Compile / compile),
2929
typeParameterShadow(Compile / compile),
3030
privateShadow(Compile / compile),
31-
experimentalOptions,
3231
)
3332

3433
// enabled to see what breaks and maybe play around with
3534
// named tuples seems likely for 3.7, modularity is not SIP approved (though I also have not seen someone arguing against)
3635
def experimentalOptions =
37-
scalacOptions ++= List("-language:experimental.modularity")
36+
scalacOptions ++= List("-language:experimental.namedTuples", "-language:experimental.modularity")
3837

3938
// Spell out feature and deprecation warnings instead of summarizing them into a single warning
4039
// always turn this on to make the compiler less ominous

0 commit comments

Comments
 (0)