Commit Graph

209 Commits

Author SHA1 Message Date
Slava Pestov
dcea491dbe Sema: Remove inference of conditional Copyable conformance from generic parameters 2024-03-06 22:47:54 -05:00
Doug Gregor
cff918428a Implement proper visibility rules for imported extensions
If an extension isn't imported either directly or via a transitive
(`@_exported`) import, its members should not be visible to name
lookup. Implement this behavior behind the experimental flag
ExtensionImportVisibility.
2024-03-04 07:43:54 -08:00
Allan Shortlidge
ba9b3023e0 AST: Make $UnavailableFromAsync and $NoAsyncAvailability baseline features.
They have been available since at least Swift 5.8.
2024-03-02 23:15:41 -08:00
Allan Shortlidge
d5e3e9418d AST: Make $UnsafeInheritExecutor a baseline feature.
It has been available since at least Swift 5.8.
2024-03-02 23:15:41 -08:00
Allan Shortlidge
969efc8413 AST: Add several language features to the baseline feature set.
This allows us to remove their explicit `UNINTERESTING_FEATURE` entries for
them FeatureSet.cpp. All of these features have been present in the compiler
since at least Swift 5.8.

NFC.
2024-03-02 23:15:41 -08:00
John McCall
1437acdf22 Implement conditional feature suppression.
Our standard conception of suppressible features assumes we should
always suppress the feature if the compiler doesn't support it.
This presumes that there's no harm in suppressing the feature, and
that's a fine assumption for features that are just adding information
or suppressing new diagnostics.  Features that are semantically
relevant, maybe even ABI-breaking, are not a good fit for this,
and so instead of reprinting the decl with the feature suppressed,
we just have to hide the decl entirely.  The missing middle here
is that it's sometimes useful to be able to adopt a type change
to an existing declaration, and we'd like older compilers to be
able to use the older version of the declaration.  Making a type
change this way is, of course, only really acceptable for
@_alwaysEmitIntoClient declarations; but those represent quite a
few declarations that we'd like to be able to refine the types of.

Rather than trying to come up with heuristics based on
@_alwaysEmitIntoClient or other sources of information, this design
just requires the declaration to opt in with a new attribute,
@_allowFeatureSuppress.  When a declaration opts in to suppression
for a conditionally-suppressible feature, the printer uses the
suppression serially-print-with-downgraded-options approach;
otherwise it uses the print-only-if-feature-is-available approach.
2024-03-01 22:10:14 -05:00
Doug Gregor
6075de1b62 Add upcoming feature ImplicitOpenExistentials for SE-0352
To maintain source compatibility, SE-0352 does not open existentials
with "self-conforming" type, such as `any Error` or existentials based
on `@objc` protocols. The proposal specified that this behavior would
change in Swift 6. Implement that behavior change, which can be
enabled prior to Swift 6 with the upcoming feature
`ImplicitOpenExistentials` (as documented in SE-0362).

Fixes #70873 / rdar://120902975.
2024-03-01 11:50:39 -08:00
Allan Shortlidge
44e44889a4 AST: Simplify usesFeatureTypedThrows().
NFC.
2024-03-01 00:16:41 -08:00
Allan Shortlidge
65e8ce5425 AST: Refactor FeatureSet out into its own file.
NFC.
2024-03-01 00:16:41 -08:00