Skip to content

[Serialization] Intro -Rmodule-recovery to remark on inconsistencies in swiftmodule files #66139

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

Merged
merged 5 commits into from
May 26, 2023

Conversation

xymus
Copy link
Contributor

@xymus xymus commented May 25, 2023

Deserialization recovery is a long standing feature designed to support reading from swiftmodule files despite small context changes. It is expected for recovery to drop errors related to Swift language version differences or cross-references to implementation-only imported modules. However, it also attempts to recover from project configuration issues, which can lead to unexpected behavior like silently dropping a function because it relies on a type that can't be deserialized. These issues used to be hard to investigate for the general developer.

To improve the situation, this PR introduces the flag -Rmodule-recovery that will display remarks when recovery drops a decl for any reason.

This follows #65713 that introduced the errors that can now be also displayed as remarks. Next I'll add contextual notes and try to improve how we display these diagnostics.

xymus added 5 commits May 18, 2023 14:15
Move some deserialization error handling services to methods under ModuleFile.
This will give access to the ASTContext and allow to report diagnostics.

Also rename `consumeErrorIfXRefNonLoadedModule` into the more general
`consumeExpectedError` that is more appropriate for future improvements.
Intro the service `diagnoseAndConsumeError` as the ultimate site to drop
deserialization issues we can recover from. It will be used to raise
diagnostics on the issues before dropping them silently.
Deserialization recovery silently drops errors and the affected decls.
This can lead to surprises when a function from an imported module
simply disappears without an explanation.

This commit introduces the flag -Rmodule-recovery to report as remarks
some of these previously silently dropped issues. It can be used to
debug project configuration issues.
@xymus xymus requested review from bnbarham, elsh and tshortli May 25, 2023 18:05
@xymus
Copy link
Contributor Author

xymus commented May 25, 2023

@swift-ci Please smoke test

1 similar comment
@xymus
Copy link
Contributor Author

xymus commented May 25, 2023

@swift-ci Please smoke test

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants