Skip to content

[Serialization] Handle re-export of error enums harder #21880

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

Conversation

jrose-apple
Copy link
Contributor

@jrose-apple jrose-apple commented Jan 15, 2019

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

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
@jrose-apple
Copy link
Contributor Author

@swift-ci Please test

@jrose-apple
Copy link
Contributor Author

@swift-ci Please test source compatibility

Copy link
Member

@DougGregor DougGregor left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, thank you

@jrose-apple jrose-apple merged commit 106c470 into swiftlang:master Jan 15, 2019
@jrose-apple jrose-apple deleted the re-re-exported-module-cleanup branch January 15, 2019 23:02
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