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
Since Any represents an unknown static type, it does not represent any known single set of values (it represents an unknown set of values). Thus it is not in the domain of the subtype, supertype, or equivalence relations on static types described above.
But we currently return true for Type::Any.is_subtype_of(Type::Any).
The reason for that is that is_subtype_of relies on is_equivalent_to.
And is_equivalent_to doesn't model type equivalence for fully static types as defined here.
But rather something (but also not exactly) what would be the is-consistent-with definition for gradual types (for example, we currently have Any.is_equivalent_to(Any) but not Any.is_equivalent_to(Int), which would be required for is-consistent-with).
Fix subtyping for gradual types
Clarify what kind of equivalence is_equivalent_to implements and potentially make it more consistent with that definition
Make sure that this is the interpretation of is_equivalent_to that we want at all call sites.
Potentially introduce is_fully_static
Make sure we still handle assignability correctly.
Make sure we still simplify unions of Any.
The text was updated successfully, but these errors were encountered:
From https://typing.readthedocs.io/en/latest/spec/concepts.html#materialization:
But we currently return true for
Type::Any.is_subtype_of(Type::Any)
.The reason for that is that
is_subtype_of
relies onis_equivalent_to
.And
is_equivalent_to
doesn't model type equivalence for fully static types as defined here.But rather something (but also not exactly) what would be the is-consistent-with definition for gradual types (for example, we currently have
Any.is_equivalent_to(Any)
but notAny.is_equivalent_to(Int)
, which would be required for is-consistent-with).is_equivalent_to
implements and potentially make it more consistent with that definitionis_equivalent_to
that we want at all call sites.is_fully_static
Any
.The text was updated successfully, but these errors were encountered: