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

More typechecking error message improvements #1308

Merged
merged 17 commits into from
Jun 10, 2023
Merged

Conversation

byorgey
Copy link
Member

@byorgey byorgey commented Jun 8, 2023

Towards #1297 . In this PR:

  • Moves some functions out of Pipeline and into more appropriate modules
  • Adds a new type Join to represent two types or other things, one "expected" and one "actual", at the point where they join + we check whether they are equal; a bunch of refactoring to use this new type. This way we don't have to remember which argument is which when calling a function that takes one "expected" thing and one "actual" thing.
  • Refactors all the decomposeXXX functions to take a Syntax node to use in error messages, and to take a Sourced UType (i.e. a UType along with whether it is "expected" or "actual") instead of just a UType so we can generate accurate error messages
  • Introduce a basic typechecking stack that keeps track of "what we are currently in the middle of checking", so that when we encounter an error we can say things like "while checking the definition of foo". Currently this is just a basic proof of concept.
  • A few other miscellaneous error message improvements.

byorgey added 8 commits June 5, 2023 14:17
- Rename `expect` to `unify`
- Add a `Syntax` argument to all `decomposeXXX` functions
- Add `Source` and `Join` machinery to properly keep track of which
  type is "expected" and which is "actual"
This helps with error messages for multi-argument polymorphic function
application (e.g. `if`).
@kostmo
Copy link
Member

kostmo commented Jun 9, 2023

FYI rebasing on main will fix the restyled error.

src/Swarm/Language/Typecheck.hs Outdated Show resolved Hide resolved
Co-authored-by: Karl Ostmo <kostmo@gmail.com>
@byorgey byorgey added the merge me Trigger the merge process of the Pull request. label Jun 9, 2023
@byorgey byorgey mentioned this pull request Jun 9, 2023
@mergify mergify bot merged commit 001ac19 into main Jun 10, 2023
@mergify mergify bot deleted the feature/typechecking-stack branch June 10, 2023 01:22
@byorgey byorgey mentioned this pull request May 30, 2024
3 tasks
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.

2 participants