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
I have seen a number of implicit resolution issues that have to do with declaration order. But they all seem to occur in fairly esoteric examples. I have what I think is a very normal example:
classBextendsA { implicitly[Int] }
classA { implicitvali=3 }
error: could not find implicit value for parameter e: IntclassBextendsA { implicitly[Int] }
A funny thing is, if you try to work around it by bringing the implicit into scope manually, you get an error because you have two implicits:
classBextendsA { valx= { implicitvalj= i; implicitly[Int] } }
classA { implicitvali=3 }
error: ambiguous implicitvalues:
both value i in classA of type=>Int
and value j of typeIntmatch expected typeIntclassBextendsA { valx= { implicitvalj= i; implicitly[Int] } }
^
But if you delete the implicit val j = i line then it cannot find the implicit.
The text was updated successfully, but these errors were encountered:
I have seen a number of implicit resolution issues that have to do with declaration order. But they all seem to occur in fairly esoteric examples. I have what I think is a very normal example:
It works in the reverse order:
A funny thing is, if you try to work around it by bringing the implicit into scope manually, you get an error because you have two implicits:
But if you delete the
implicit val j = i
line then it cannot find the implicit.The text was updated successfully, but these errors were encountered: