-
Notifications
You must be signed in to change notification settings - Fork 10.5k
Fix asserts and crashes caused by skipping function bodies or allowing errors #37701
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
@swift-ci please test |
@swift-ci please test |
Build failed |
@swift-ci please test Linux platform |
Build failed |
@swift-ci please test macOS platform |
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 look good but we should try to drop completely invalid code earlier, like a destructor on a source file. I don't think there's value to preserve these for the AllowModuleWithCompilerErrors use cases and it may require a decent amount of maintenance to keep this working.
When allowing errors any attribute could be on any decl, so don't verify whether an attribute can appear on a decl. Note that these attributes aren't serialized anyway since they'll be set to invalid during typechecking and hence skipped.
Most invalid attributes are skipped from serialization entirely, but custom attributes don't have their invalid bit set - the particular custom attribute (eg. a property wrapper) is requested when needed and skipped if invalid. Those checks can't set the invalid bit since the attribute could be a different custom attribute (eg. a result builder).
Note that deserialization already handles this case when recovery is enabled.
Good point @xymus, thanks. I've changed the serialization to just skip destructors if they're invalid and we're allowing errors. I also added a further comment to the attribute commits - invalid attributes are already skipped, so:
@swift-ci please test |
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.
Thanks!
I ran the stress tester locally with the new TestModule request and found a few new asserts and crashes. I'll run it again with these changes to see if it finds any more. Might actually be able to enable by default - with skipping all function bodies and WMO enabled it took ~30 minutes locally, which includes actually building the projects.