-
Notifications
You must be signed in to change notification settings - Fork 10.5k
[Diag] [Typechecker] Diagnose throw in defer properly #23311
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
Conversation
cc @xedin |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM!
@swift-ci please smoke test and merge |
@theblixguy Looks like there is a problem in verifier. |
@xedin Hmm this makes sense since we're backing out of error type checking if we're in a defer body. I have fixed it now. Could you trigger the test again? Should be all good! |
@swift-ci please smoke test and merge |
1 similar comment
@swift-ci please smoke test and merge |
@swift-ci please smoke test |
@xedin Could you trigger the CI again? Had to make a small change! Thank you! |
@swift-ci please smoke test |
Unrelated build failure:
|
@swift-ci please smoke test macOS platform |
Seems like the bots are not working correctly today 😅 Something's wrong with LLDB |
We'll just have to wait until that's cleared, unfortunately... |
No problem! |
Okay, let's give the tests one more try. @xedin can you invoke the CI? |
@swift-ci please smoke test |
All tests have passed 🙏 🎉 |
Ok, great! Let's run source compatibility just in case... |
@swift-ci please test source compatibility |
Hmm I don't think the source compat test ran (or maybe the CI screwed up) 🤔
|
@swift-ci please test source compatibility |
The body of a
defer
statement is an implicitFuncDecl
, but that's implementation detail and it shouldn't leak into diagnostics. For example, we end up emitting an incorrect diagnostic when using athrow
in adefer
:Treat
throw
the same way we treat other control flow statements, likereturn
,break
&yield
when used inside adefer
.