You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
traitSemiGroup[T]:defcombine(x: T, y: T):TtraitMonoid[T] extendsSemiGroup[T]:defunit:TclassAgivenMonoid[A]:defcombine(x: A, y: A) =???defunit=???classBgivenMonoid[B]:defcombine(x: B, y: B) =???defunit=???importgiven_Monoid_A.combineimportgiven_Monoid_B.combinevala=newAvalb=newB
println(combine(b, b))
^^^^^^^Reference to combine is ambiguous,
it is both imported by name by importdotty.DottyPredef.{...}
and imported by name subsequently by importgiven_Monoid_B.combine
The text was updated successfully, but these errors were encountered:
The latter is an overloaded symbol C.combine, where an alternative is picked by overload resolution.
The former is an ambiguity in name binding, because there is no basis for preferring one binding over the other.
This comes up periodically, where the expectation is that a multiple-binding could be treated like an overloaded symbol, much as multiple candidates in an implicit search are resolved using the same procedure as overload resolution.
I think the expectation is that intertwining name resolution and typechecking more than the minimum would invite cycles.
The text was updated successfully, but these errors were encountered: