Skip to content

Commit

Permalink
fix: fix an implicit resolution that was failing with scala 3.4
Browse files Browse the repository at this point in the history
  • Loading branch information
etorreborre committed Mar 31, 2024
1 parent a41247b commit 4444b12
Showing 1 changed file with 6 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,12 @@ object Diffable extends DiffableLowImplicits:
def diff[T](actual: T, expected: T)(using di: Diffable[T]): ComparisonResult =
di.diff(actual, expected)

// scala collections
given mapDiffable[K: Diffable, V: Diffable, M <: Map[K, V]]: Diffable[M] = new MapDiffable[K, V, M]
given seqDiffable[E: Diffable, S <: Seq[E]]: Diffable[S] = new SeqLinesDiffable[E, S]
given setDiffable[E: Diffable, S <: Set[E]]: Diffable[S] = new SetDiffable[E, S]
given arrayDiffable[E: Diffable]: Diffable[Array[E]] = new ArrayDiffable

// Needed to avoid ambiguous implicits with Dotty when looking for a Diffable
// for `Either[Int, Nothing]` for example.
given nothingDiffable: Diffable[Nothing] = NothingDiffable
Expand All @@ -54,11 +60,6 @@ object Diffable extends DiffableLowImplicits:
given tryDiffable[T: Diffable, S <: Try[T]]: Diffable[S] = new TryDiffable[T, S]
given failureDiffable: Diffable[Failure[Nothing]] = new FailureDiffable

// scala collections
given mapDiffable[K: Diffable, V: Diffable, M <: Map[K, V]]: Diffable[M] = new MapDiffable[K, V, M]
given setDiffable[E: Diffable, S <: Set[E]]: Diffable[S] = new SetDiffable[E, S]
given seqDiffable[E: Diffable, S <: Seq[E]]: Diffable[S] = new SeqLinesDiffable[E, S]
given arrayDiffable[E: Diffable]: Diffable[Array[E]] = new ArrayDiffable

trait DiffableLowImplicits extends DiffableLowImplicits2:
given optionDiffable[T: Diffable, S <: Option[T]]: Diffable[S] = new OptionDiffable[T, S]
Expand Down

0 comments on commit 4444b12

Please sign in to comment.