Commit Graph

8 Commits

Author SHA1 Message Date
Allan Shortlidge
7dc313f1be NFC: Fix tests that mistakenly rely on unavailable stored properties.
Preparation for rdar://107449845
2023-04-04 08:52:39 -07:00
Allan Shortlidge
620462ddf6 Sema: Don't diagnose declarations more available than unavailable container.
It turns out that we must allow declarations with `introduced:` availability
nested inside of other declarations that are `unavailable` in order to
influence weak linking. Stop diagnosing declarations as being more available
than their unavailable containers and revert some changes to availability
inference that were designed to avoid creating these nestings but caused
regressions for declarations marked `@_spi_available.`

Reverts parts of https://github.com/apple/swift/pull/64310,
https://github.com/apple/swift/pull/64015, and
https://github.com/apple/swift/pull/62900.
2023-03-21 13:55:05 -07:00
Allan Shortlidge
4058ad1421 AST: Improved inferred availability accuracy.
Previously, when creating availability attributes for synthesized declarations
we would identify some set of reference declarations that the synthesized
declaration should be as-available-as. The availability attributes of the
reference declarations would then be merged together to create the attributes
for the synthesized declaration. The problem with this approach is that the
reference declarations themselves may implicitly inherit availability from their
enclosing scopes, so the resulting merged attributes could be incomplete. The
fix is to walk though the enclosing scopes of the reference declarations,
merging the availability attributes found at each level.

Additionally, the merging algorithm that produces inferred availability
attributes failed to deal with conflicts between platform specific and platform
agnostic availability. Now the merging algorithm notices when platform agnostic
availability should take precedence and avoids generating conflicting platform
specific attributes.

Resolves rdar://106575142
2023-03-13 18:27:03 -07:00
Allan Shortlidge
2a3798e1c9 Tests: Raise the deployment target in generalized_accessors_availability.swift. 2023-03-13 18:27:03 -07:00
Holly Borla
b774acd1f0 [Property Wrappers] If a property wrapper accessor is synthesized using the
enclosing-self subscript, infer availability from accessors on the subscript
declaration.
2021-04-15 12:44:16 -07:00
Mishal Shah
22f61df98b Use %target-cpu in the tests to support running on Apple Silicon hardware 2021-04-08 23:26:18 -07:00
Holly Borla
e1de140dbb [Property Wrappers] Intersect the availability of the wrapped/projected value
setter with the availability of the enclosing scope when inferring the
availability of the synthesized setters for an applied property wrapper.
2021-04-01 18:11:05 -07:00
Joe Groff
85b549a51b Sema: Synthesized setters get the availability of the decl they're synthesized from.
If a modify/mutableAddress coroutine is defined with availability, or a property wrapper adds a setter with availability,
then the implicit synthesized setter should be as available as those declarations it's synthesized from. rdar://problem/65152582
2020-07-10 10:33:59 -07:00