Skip to content

Track spans and TypeTrace when relating unbound type variables in type inferencer #16847

Closed
@nikomatsakis

Description

@nikomatsakis

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 type T, the other will also be bound to a type U (derived from T) and T and U 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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-type-systemArea: Type systemC-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-typesRelevant to the types team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions