-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Closed
Closed
Copy link
Labels
bugSomething isn't workingSomething isn't workingtyMulti-file analysis & type inferenceMulti-file analysis & type inference
Description
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_toimplements and potentially make it more consistent with that definition - Make sure that this is the interpretation of
is_equivalent_tothat 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. - Add new property test: non-fully-static types should never participate in subtyping
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugSomething isn't workingSomething isn't workingtyMulti-file analysis & type inferenceMulti-file analysis & type inference