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
For a covariant generic G, the join of G[int] and G[str], is currently just object, not G[object] as it (I believe) should be.
This behaviour is wrong for contravariant types, in this case there should be a meet of arguments: so that join(C[int], C[float]) should be C[int] for contravariant C, while currently it is C[float].
A correct behaviour would to check for every type argument position:
if the class is covariant in it, calculate join of args on the left and right
if the class is contravariant in it, calculate meet of args
if the class is invariant in it, check that the type on the left and right are the same
if the last one didn't hold, fall back to object.
verify bounds and values restrictions for new args, if some are not satisfied, fall back to object.
(optional) if one of the meets in third bullet produced an UninhabitedType, fall back to object as well.
The text was updated successfully, but these errors were encountered:
Currently, joins for the instances of same type are calculated using this code:
This has two problems:
G
, the join ofG[int]
andG[str]
, is currently justobject
, notG[object]
as it (I believe) should be.join(C[int], C[float])
should beC[int]
for contravariantC
, while currently it isC[float]
.A correct behaviour would to check for every type argument position:
object
.object
.UninhabitedType
, fall back toobject
as well.The text was updated successfully, but these errors were encountered: