Skip to content

Sema: Don't derive witnesses in swiftinterface files #38937

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

slavapestov
Copy link
Contributor

This fixes a regression from #36752.

Previously, a RawRepresentable enum would use the default implementation
of == from a protocol extension in the standard library. After the above
PR, we began synthesizing the == operator, just like we do for ordinary
enums.

However, when type checking an older swiftinterface file, we would
still synthesize the declaration and try to use it, even though it would
not have existed in the older dylib built with the older compiler.

Fix this by not deriving witnesses in swiftinterface files at all.
The interface should already explicitly list out all derived witnesses;
if one is not listed, it should not be derived, because it does not
exist in the dylib.

Fixes rdar://problem/80466745.

This fixes a regression from swiftlang#36752.

Previously, a RawRepresentable enum would use the default implementation
of == from a protocol extension in the standard library. After the above
PR, we began synthesizing the == operator, just like we do for ordinary
enums.

However, when type checking an older swiftinterface file, we would
still synthesize the declaration and try to use it, even though it would
not have existed in the older dylib built with the older compiler.

Fix this by not deriving witnesses in swiftinterface files at all.
The interface should already explicitly list out all derived witnesses;
if one is not listed, it should not be derived, because it does not
exist in the dylib.

Fixes rdar://problem/80466745.
@slavapestov
Copy link
Contributor Author

@LucianoPAlmeida I believe this should fix the ABI break from your earlier PR. Please take a look.

@slavapestov
Copy link
Contributor Author

@swift-ci Please smoke test

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov requested a review from CodaFi August 18, 2021 20:26
@LucianoPAlmeida
Copy link
Contributor

@LucianoPAlmeida I believe this should fix the ABI break from your earlier PR. Please take a look.

Thank you for fixing this @slavapestov! =]

@LucianoPAlmeida
Copy link
Contributor

@swift-ci Please smoke test Linux Platform

@slavapestov
Copy link
Contributor Author

@swift-ci Please test source compatibility

@slavapestov slavapestov merged commit d50a37d into swiftlang:main Aug 19, 2021
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