Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Correct the behavior of generalize in the typechecker #2176

Merged
merged 3 commits into from
Jan 14, 2025

Conversation

sauclovian-g
Copy link
Contributor

Fixes #2105.

Copy link
Contributor

@RyanGlScott RyanGlScott left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Excellent work!

src/SAWScript/MGU.hs Outdated Show resolved Hide resolved
src/SAWScript/MGU.hs Outdated Show resolved Hide resolved
src/SAWScript/MGU.hs Outdated Show resolved Hide resolved
src/SAWScript/MGU.hs Outdated Show resolved Hide resolved
@sauclovian-g
Copy link
Contributor Author

I'm going to rebase this on top of the lmdb-python bump (should probably have done that the other way around, oops, too late now) then merge it.

We do need to search the value environment for mentions of unification
vars, because if we're nested inside several layers of declaration we
could be referring to unification vars coming from an outer scope, and
those shouldn't be forall-bound until we close off that scope.

We also need to search the right hand side of typedefs for the same
reason; this was previously wrong although it would be at least
moderately difficult to step on.

However, for named vars the names we should not bind are the _keys_ of
the type name environment; those are the type vars that already exist.

We don't allow random named type vars to float around any more, so
that should always exclude all named type vars we have. (I haven't
added an assertion for this, but perhaps I should have.)

Fixes #2105.
@sauclovian-g sauclovian-g merged commit fce73f3 into master Jan 14, 2025
10 checks passed
@sauclovian-g sauclovian-g deleted the 2105-generalize branch January 14, 2025 22:34
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.

Typechecker gap with record argument types
2 participants