-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Open
Labels
area:implicitsrelated to implicitsrelated to implicitsitype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymorestat:needs minimizationNeeds a self contained minimizationNeeds a self contained minimization
Description
Compiler version
3.3.7 (also seen in 3.7.3)
Minimized code
//> using scala 3.3.7
//> using options -Wall -Werror
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.Output
No given instance of type cats.kernel.Eq[Any] was found for a context parameter of method apply in object MergeResult
.map(MergeResult.apply)
Expectation
This used to build under 3.3.6, now fails because the given for Eq[Element] is not used, rather a search for Eq[Any] takes place.
My expectation was that the explicit return type of Option[Element] should have forced the correct resolution of the given.
NOTE: changing the function application to MergeResult.apply[Element] works around this problem.
tgodzik
Metadata
Metadata
Assignees
Labels
area:implicitsrelated to implicitsrelated to implicitsitype:bugregressionThis worked in a previous version but doesn't anymoreThis worked in a previous version but doesn't anymorestat:needs minimizationNeeds a self contained minimizationNeeds a self contained minimization