[Serialization] Handle re-export of error enums harder #21880
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
A refinement of Doug's e3207f7 from a year ago to account for trying to reference an import-as-member error enum through an overlay when it's in a Clang module using
export_as
. The problem is that importing error enums synthesizes a corresponding struct, and that struct doesn't have a Clang node and so when it isn't found in the right module the compiler didn't know to allow it anyway.I know, right?
(Looking at the source change might be simpler than trying to read the above paragraph.)
I'm still not 100% sure on how this occurred in the original (Apple-internal) projects hitting this, but I think it's just that we handle all import-as-member types at once, and the clients were using something else from a type that contained the error enum, and then that resulted in the error struct's conformances getting written into a serialized swiftmodule.
rdar://problem/47152185