Skip to content
This repository was archived by the owner on Jan 24, 2025. It is now read-only.

Commit dc0595d

Browse files
committed
Fix incorrect singnature for DiffLenses methods
1 parent 3570798 commit dc0595d

File tree

2 files changed

+11
-2
lines changed

2 files changed

+11
-2
lines changed

core/src/main/scala/com/softwaremill/diffx/Diff.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,11 +101,11 @@ case class DiffLens[T, U](outer: Diff[T], path: List[String]) {
101101
}
102102
def ignore(): Diff[T] = outer.modifyUnsafe(path: _*)(Diff.ignored)
103103

104-
def withMapMatcher[K, V](m: ObjectMatcher[(K, V)])(implicit ev1: U <:< scala.collection.Map[K, V]): Diff[T] =
104+
def withMapMatcher[K, V](m: ObjectMatcher[MapEntry[K, V]])(implicit ev1: U <:< scala.collection.Map[K, V]): Diff[T] =
105105
outer.modifyMatcherUnsafe(path: _*)(m)
106106
def withSetMatcher[V](m: ObjectMatcher[V])(implicit ev2: U <:< scala.collection.Set[V]): Diff[T] =
107107
outer.modifyMatcherUnsafe(path: _*)(m)
108-
def withListMatcher[V](m: ObjectMatcher[(Int, V)])(implicit ev3: U <:< Iterable[V]): Diff[T] =
108+
def withListMatcher[V](m: ObjectMatcher[IterableEntry[V]])(implicit ev3: U <:< Iterable[V]): Diff[T] =
109109
outer.modifyMatcherUnsafe(path: _*)(m)
110110
}
111111
case class DerivedDiffLens[T, U](outer: Diff[T], path: List[String]) {

core/src/test/scala/com/softwaremill/diffx/test/DiffModifyIntegrationTest.scala

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package com.softwaremill.diffx.test
22

3+
import com.softwaremill.diffx.ObjectMatcher.IterableEntry
34
import com.softwaremill.diffx._
45
import org.scalatest.flatspec.AnyFlatSpec
56
import org.scalatest.matchers.should.Matchers
@@ -135,4 +136,12 @@ class DiffModifyIntegrationTest extends AnyFlatSpec with Matchers {
135136
)
136137
)
137138
}
139+
140+
it should "compare lists using object matcher comparator passed explicitly" in {
141+
val o1 = Organization(List(p1, p2))
142+
val o2 = Organization(List(p2, p1))
143+
val om: ObjectMatcher[IterableEntry[Person]] = ObjectMatcher.byValue(_.name)
144+
val d = Diff[Organization].modify(_.people).withListMatcher(om)
145+
compare(o1, o2)(d).isIdentical shouldBe true
146+
}
138147
}

0 commit comments

Comments
 (0)