Track spans and TypeTrace when relating unbound type variables in type inferencer #16847
Labels
A-type-system
Area: Type system
C-enhancement
Category: An issue proposing an enhancement or a PR with one.
T-compiler
Relevant to the compiler team, which will review and decide on the PR/issue.
T-types
Relevant to the types team, which will review and decide on the PR/issue.
The new type inferencer in PR #15955 does not track spans as precisely as it could. When two unbound type variables are related to one another, it records the relation (subtype, supertype, equality) but does not record the reason that the relation exists (i.e., the associated span and
TypeTrace
). When one of those two variables is later bound to a specific typeT
, the other will also be bound to a typeU
(derived fromT
) andT
andU
will be related -- but this relation will use the current span and TypeTrace, rather than the original span. The primary side-effect of this is that the output from a "cannot infer" message will be more confusing -- but given that that output is already pretty useless, I was unable to get a good example.The text was updated successfully, but these errors were encountered: