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

Semantic analysis should reject ret, next, and break expressions in defer statements #65

Closed
alexrp opened this issue Mar 31, 2023 · 1 comment
Labels
area: analysis Issues related to language analyses. area: language Issues related to the design of the language. area: tests Issues related to the test suite.
Milestone

Comments

@alexrp
Copy link
Member

alexrp commented Mar 31, 2023

Consider:

{
    defer ret :ok;

    raise err MyError {};
}

We clearly shouldn't allow this as the defer statement effectively becomes a weird kind of try/catch-like mechanism.

@alexrp alexrp added state: confirmed Bugs that have been confirmed and are reproducible. type: bug area: analysis Issues related to language analyses. area: tests Issues related to the test suite. labels Mar 31, 2023
@alexrp alexrp added this to the v1.0 milestone Mar 31, 2023
@alexrp alexrp self-assigned this Mar 31, 2023
@alexrp
Copy link
Member Author

alexrp commented Mar 31, 2023

Also:

  • ret expressions should be rejected if there's no parent function to bind to.
  • raise expressions and error-propagating calls, notably, should be allowed in defer statements.
  • We should attach a list of ret expressions to FunctionDeclarationSemantics/LambdaExpressionSemantics.

@alexrp alexrp changed the title Semantic analysis should reject branch expressions and error-propagating calls in defer statements Semantic analysis should reject ret, next, and break expressions in defer statements Mar 31, 2023
alexrp added a commit that referenced this issue Mar 31, 2023
Also attach ReturnExpressionSemantics instances to the enclosing
FunctionDeclarationSemantics/LambdaExpressionSemantics.

Part of #65.
@alexrp alexrp closed this as completed in fffbef6 Mar 31, 2023
@alexrp alexrp added area: language Issues related to the design of the language. and removed state: confirmed Bugs that have been confirmed and are reproducible. labels Mar 31, 2023
@alexrp alexrp removed their assignment Jan 27, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: analysis Issues related to language analyses. area: language Issues related to the design of the language. area: tests Issues related to the test suite.
Development

No branches or pull requests

1 participant