-
-
Notifications
You must be signed in to change notification settings - Fork 419
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
Fix return checking in behaviours and constructors #3971
Conversation
To be a full PR, this needs a regression test added as well as release notes and the PR comments etc cleaned up. |
return
checking in constructors and behaviors
Hi @SeanTAllen, The changelog - fixed label was added to this pull request; all PRs with a changelog label need to have release notes included as part of the PR. If you haven't added release notes already, please do. Release notes are added by creating a uniquely named file in the The basic format of the release notes (using markdown) should be:
Thanks. |
return
checking in constructors and behaviorsreturn
checking in constructors and behaviours
return
checking in constructors and behavioursreturn
checking in behaviours and constructors
When this is squashed for merging, the comment should be: Fix return checking in behaviours and constructors Our checks to make sure that the usage of return in behaviours and constructors was overly restrictive. It was checking for any usage of For example: actor Main
new create(env: Env) =>
let f = {() => if true then return None end} Would return an error despite the return being in a lambda and therefore not returning a value from the constructor. |
return
checking in behaviours and constructors
Looks good, but can you also add a test showing that this works for object literals (and if it doesn't, fix the code so that it does)? |
@jemc 2 additional tests were added. Let me know if it looks good. This always worked for object literals. The problem was the check came before the lambda's got desugared. The additional tests verify that it working for object literals (an axiom upon which this is based) continues to remain true. |
Our checks to make sure that the usage of return in behaviours and constructors was overly restrictive. It was checking for any usage of
return
that had a value including when the return wasn't from the method itself.For example:
Would return an error despite the return being in a lambda and therefore not returning a value from the constructor.
Fixes #3682