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
This fails because Bar[Int] is not considered more specific than Foo[Any], because the variance-flipping we do in isAsSpecificValueType is not thorough enough:
hasMatchingMember returns the original member T in Bar where the variance is not flipped (=- Int). We could add a special case in hasMatchingMember but then we might miss some other cases.
Personally, I've never really been convinced by the rationale for flipping only at the top-level, so I think the simplest solution would be to flip at all levels, then we could use a global mode.
The text was updated successfully, but these errors were encountered:
We've agreed in our internal meeting that the current Dotty behavior is wrong and should be changed so that Bar[Int] is more specific; we've also agreed to keep the current "flip variance only at the top-level" semantics. Of course all of this might still change in the future based on user feedback, etc, which hopefully Miles' implementation will help us get!
The Dotty resolution algorithm was recently ported to scalac by @milessabin in scala/scala#6037 (comment) where this came up:
This fails because
Bar[Int]
is not considered more specific thanFoo[Any]
, because the variance-flipping we do inisAsSpecificValueType
is not thorough enough:hasMatchingMember
returns the original memberT
inBar
where the variance is not flipped (=- Int
). We could add a special case inhasMatchingMember
but then we might miss some other cases.Personally, I've never really been convinced by the rationale for flipping only at the top-level, so I think the simplest solution would be to flip at all levels, then we could use a global mode.
The text was updated successfully, but these errors were encountered: