-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Request-ify synthesis of the main function for the @main attribute #32767
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
Request-ify synthesis of the main function for the @main attribute #32767
Conversation
CC @compnerd |
@swift-ci Please smoke test |
@swift-ci Please test source compatibility |
test/SILGen/`
Outdated
@@ -0,0 +1,17 @@ | |||
// RUN: %target-swift-emit-silgen -parse-as-library %s |
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.
This file is called (`
), is this expected?
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.
No, that's a mistake. oops
This simplifies matters if checking an attribute adds members to the nominal type or extension.
188e0d5
to
7bc5088
Compare
@swift-ci Please smoke test |
@swift-ci Please test source compatibility |
@swift-ci Please smoke test |
@swift-ci Please test source compatibility |
@swift-ci please test Windows platform |
auto &context = D->getASTContext(); | ||
|
||
MainTypeAttr *attr = D->getAttrs().getAttribute<MainTypeAttr>(); | ||
if (attr == nullptr) |
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.
Should this be an assert instead?
Now that EmittedMembersRequest is cached, we need to synthesize it when collecting all the members of the class. Use a request for this, instead of just doing it from the AttributeChecker.
Also add some SILGen tests to ensure that the main function is actually emitted; previously we didn't test for this.
This fixes the regression from #32581.