Skip to content

freeze type vars after structure is extracted #2262

Closed
@nikomatsakis

Description

@nikomatsakis

I'm pretty sure that it is possible for the following things to happen today:

  1. We infer a type with bounds X <: T <: top
  2. We resolve T structurally based on X
  3. T acquires an upper bound and perhaps migrates away

I don't have a specific bad example, but I think it could lead to inconsistencies, perhaps with impl dispatch, perhaps elsewhere. This issue is kind of a note to myself to come up with some examples and make some tests and be sure we're ok. I think what it amounts to is that whenever we do a type-dependent operation, we should go back and assert this type as the upper-bound, so that the type inferencer doesn't come away with a more liberal upper-bound.

Our quite limited subtyping might also make this less relevant.

Metadata

Metadata

Assignees

Labels

A-type-systemArea: Type systemC-cleanupCategory: PRs that clean code up or issues documenting cleanup.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions