Skip to content

Freshening asks a different question than type_level, so it needs its own - #71

Merged
dpmills merged 1 commit into
mainfrom
dmills/freshen-level
Aug 12, 2026
Merged

Freshening asks a different question than type_level, so it needs its own#71
dpmills merged 1 commit into
mainfrom
dmills/freshen-level

Conversation

@dpmills

@dpmills dpmills commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

A specialization clone must share no live inference state with the definition it was cloned from. That invariant breaks when a quantified variable is reachable only through a refinement predicate: freshen_above short-circuits on type_level, which is predicate-blind (it reports a Refinement's base level), so a type whose only above-cutoff content sits in a nested predicate is returned verbatim — still pointing at the definition's own variables. The symptom is a duplicate specialization, the clone reaching one generalized let both through freshened variables and through the original's.

The fix is a second level function, not a change to type_level, whose predicate-blindness is load-bearing for its other callers (extrusion, bound-recording scope, should_generalize); freshen_level's doc comment states the two questions. No measured cost.

@dpmills
dpmills requested a review from a team as a code owner August 10, 2026 20:52
…ts own

A specialization clone must share no live inference state with the definition it was cloned from. That invariant breaks when a quantified variable is reachable only through a **refinement predicate**: `freshen_above` short-circuits on `type_level`, which is predicate-blind (it reports a `Refinement`'s base level), so a type whose only above-cutoff content sits in a nested predicate is returned verbatim — still pointing at the definition's own variables. The symptom is a duplicate specialization, the clone reaching one generalized `let` both through freshened variables and through the original's.

The fix is a second level function, not a change to `type_level`, whose predicate-blindness is load-bearing for its other callers (extrusion, bound-recording scope, `should_generalize`); `freshen_level`'s doc comment states the two questions. No measured cost.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants