6.0: [TypeCheckAttr] @frozen is valid even when building without enable-library-evolution #73788
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.
Explanation: Fix inference of
Sendable/BitwiseCopyableon@frozenenums in non-resilient modules like the embedded stdlib.Previously, when type-checking the
@frozenattribute on an enum, if the module was being built non-resiliently (without-enable-library-evolution), the attribute would silently be invalidated and ignored. It was ignored even if the attribute was applied to a non-exported type.Inference of conformance to
SendableandBitwiseCopyableonly proceeds on exported types if they are marked@frozen(with a non-invalidated attribute). The silent invalidation of@frozenon exported enums in non-resilient modules resulted in conformance not being inferred for those enums. For example, the embedded stdlib is built without resilience, so neitherUnboundedRange_'s conformance toSendablenorNever's conformance toBitwiseCopyablewere inferred.Here, this is fixed. Exported enums keep the attribute, and non-exported enums get a warning if the attribute is applied.
Fixes a failure to infer conformances to
SendableandBitwiseCopyablein the stdlib when building for embedded.Scope: Affects
@frozenannotations.Issue: rdar://128358780
Original PR: #73756
Risk: Low. Does unsuppress a warning when using
@frozenon non-exported enums in non-resilient modules, however.Testing: Added a test demonstrating that
Sendable/BitwiseCopyableinference on@frozenexported enums in non-resilient modules occurs as intended.Reviewer: Doug Gregor ( @DougGregor )