Just upgraded to Scala 3.3.7 from 3.3.6 and was bitten by this:
case class MergeResult[Element: Eq] private (segments: Seq[Segment[Element]]):
def fuseWith(another: MergeResult[Element])(
elementFusion: (Element, Element) => Option[Element]
): Option[MergeResult[Element]] =
if segments.size != another.segments.size then None
else
Traverse[Seq]
.traverse(segments.zip(another.segments))(_.fuseWith(_)(elementFusion))
.map(MergeResult.apply)
// ^^^^^ Can't find the given for Eq[Any], despite there
// being an Eq[Element] available.
This used to compile under 3.3.6.
I’ve worked around this by changing the function application to MergeResult.apply[Element], but was curious - is this, ahem, a bug or feature?
I recall there were changes about given resolution over a hierarchy of types a while back, but I thought type unification would propagate from the explicit return type of Option[MergeResult[Element]] to force pulling in the given for Eq[Element]?