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

stage2: astgen for try #7606

Closed
wants to merge 1 commit into from
Closed

stage2: astgen for try #7606

wants to merge 1 commit into from

Conversation

g-w1
Copy link
Contributor

@g-w1 g-w1 commented Dec 30, 2020

I used orelseCatchExpr as inspiration for most of the tryExpr function. This is my first astgen expr, so please tell me if something is not idomatic.

I also moved the -femit-zir code higher up in the updateModule function so that even if sema fails, you still get the ir in $file.zir.

I couldn't find a way to test this.

@LemonBoy
Copy link
Contributor

See #3461 for a stage1 bug related to how try is desugared.
See #7541 for another stage1 bug that's related to the very same thing, this time caused by the explosion of try in many simple (and unlinked) IR pieces that may get constant-folded separately,

@g-w1
Copy link
Contributor Author

g-w1 commented Dec 30, 2020

Wow, everything is coming together. I was just thinking about how to implement inferred error sets yesterday. Both of these issues stem from that. The call that checks if the errorset matches the return type is this: https://github.com/ziglang/zig/pull/7606/files#diff-2600885f5a9e88bc263d2b47daab6d1c33418966af8f42b26c188597c108201bR930-R940 I think since I will probably also be implementing inferred error sets soon, I will keep this in the back of my head. If these bugs were to happen, they would not happen in astgen for try but in the coercion code and semantic analysis code for inferred/regular error sets.

@LemonBoy
Copy link
Contributor

If these bugs were to happen, they would not happen in astgen for try but in the coercion code and semantic analysis code for inferred/regular error sets.

We'll see.

@andrewrk andrewrk added the frontend Tokenization, parsing, AstGen, Sema, and Liveness. label Jan 12, 2021
…n e;`

except without the overhead of a local var
Copy link
Member

@andrewrk andrewrk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd like to get orelse/catch hooked up all the way through the compiler with test coverage before adding more astgen that uses similar logic, to make sure we are going in the right direction here.

@g-w1
Copy link
Contributor Author

g-w1 commented Jan 18, 2021 via email

@andrewrk
Copy link
Member

andrewrk commented Feb 1, 2021

This PR will have to be re-done now that #7847 is landed.

@andrewrk andrewrk closed this Feb 1, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
frontend Tokenization, parsing, AstGen, Sema, and Liveness.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants