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

Constrain early returns in functions in addition to closures #7204

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

smores56
Copy link
Collaborator

@smores56 smores56 commented Nov 8, 2024

When I initially implemented the return keyword, I only added type constraints to early returns in untyped closures because I misunderstood how typed closures/functions were constrained. This copies the code for early return constraints to the function type constraining code.

Note: if you annotate a function like myFunction : Result U64 [MyErr] -> Result U64 [MyErr, Other], the error types will not properly unify, and you'll get a type error. This is a behavior that exists without early returns (I checked), and you can find discussion from Ayaz surrounding it here.

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