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

Apply bindings before returning unification mismatch error #1972

Merged
merged 2 commits into from
Jun 23, 2024

Conversation

byorgey
Copy link
Member

@byorgey byorgey commented Jun 22, 2024

Closes #1888. When we discovered a type mismatch, we were not fully substituting everything we had learned about the types (via applyBindings) before reporting the error. For example, in #1888 we had 2 : u1 and a unification constraint u1 = Int -> u2, but we were just reporting the type of 2 as u1 rather than first substituting Int -> u2 for u1.

I think we have had this problem for a while, but the recent rewrite of the unification engine possibly made the effects more noticeable.

This incidentally improved a couple more error messages in the test suite. =)

@byorgey byorgey force-pushed the push-tnoyvzunsuxx branch from 765bfd4 to d54ddb4 Compare June 22, 2024 23:05
Copy link
Member

@xsebek xsebek left a comment

Choose a reason for hiding this comment

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

Traversals are impressive feats of magic. 😲

deriving (Functor)

instance Foldable Join where
foldMap :: Monoid m => (a -> m) -> Join a -> m
Copy link
Member

Choose a reason for hiding this comment

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

Is this used anywhere?

Copy link
Member Author

Choose a reason for hiding this comment

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

Not directly, but Foldable is a prerequisite of Traversable.

@byorgey byorgey added the merge me Trigger the merge process of the Pull request. label Jun 23, 2024
@mergify mergify bot merged commit 9fe1184 into main Jun 23, 2024
12 checks passed
@mergify mergify bot deleted the push-tnoyvzunsuxx branch June 23, 2024 13:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
merge me Trigger the merge process of the Pull request.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Poor type error message for Int used in function context
3 participants