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

[Analyzer] Enrich type unification errors with info about expected type #421

Open
Martinsos opened this issue Jan 8, 2022 · 0 comments
Open
Labels
analyzer wasp compiler frontend hm Requires more thought

Comments

@Martinsos
Copy link
Member

TypeChecker currently does typechecking in two main phases: unification (figuring out the strictes sub-type that works for all of the types in smth like e.g. list) and then weakening (figuring out if certain type can be "weakened" / coerced into a second (expected) type.
If an error happens during unification, we currently don't know in our implementation what is the expected type so we don't report that. We could do know it, it just not implemented that way.
If we wanted, we could refactor this piece of code so that information actually becomes available, probably by making phases of unification and weakening more interwined.

NOTE: If sum types (#381) get implemented, this probably won't be a concern any more, since there will likely be no more unification errors.

@Martinsos Martinsos added hm Requires more thought analyzer wasp compiler frontend labels Jan 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
analyzer wasp compiler frontend hm Requires more thought
Projects
None yet
Development

No branches or pull requests

1 participant