Commit Graph

1079 Commits

Author SHA1 Message Date
Becca Royal-Gordon
c44284d874 Diagnose invalid @_hasStorage attributes
A bug in `@objc @implementation` is causing incorrect `@_hasStorage` attributes to be printed into module interfaces. As an initial step towards fixing this, diagnose bad `@_hasStorage` attributes and treat them as computed properties so that these malformed interfaces don’t cause compiler crashes.

Partially fixes rdar://144811653.
2025-03-27 16:24:44 -07:00
Becca Royal-Gordon
7703d115db Filter bad attrs out of module interface @abis
When printing an `@abi` attribute’s decl, we now filter out any attrs that are not valid in that position. Fixes a broken test.
2025-03-26 10:47:58 -07:00
Alexis Laferrière
a4aaa1063a Merge pull request #80098 from xymus/upstream-swiftmodule-blocklist
Frontend: Upstream blocklist check when ignoring adjacent swiftmodule files
2025-03-26 10:28:30 -07:00
Anthony Latsis
631a04e56c Merge pull request #80159 from AnthonyLatsis/danaus-plexippus-5
Sema: Extend adoption mode for `AsyncCallerExecution` to storage declarations
2025-03-26 04:40:58 +00:00
Anthony Latsis
8ad2e02596 Sema: Allow @execution on storage declarations 2025-03-25 02:07:04 +00:00
Anthony Latsis
d73402af25 AST: Restrict @execution to func and init declarations 2025-03-25 02:07:04 +00:00
Alexis Laferrière
7d3ed787a1 Frontend: Upstream blocklist check in ignoring adjacent swiftmodule files 2025-03-19 14:15:34 -07:00
Andrew Trick
64a48d08e1 Update tests for strict @lifetime type checking 2025-03-19 11:59:04 -07:00
Pavel Yaskevich
bb6326bb32 [AST] Adjust usesFeatureExecutionAttribute to cover accessors 2025-03-14 17:29:48 -07:00
Doug Gregor
0cfa048c0a [Isolated conformances] Start parsing 'nonisolated' on conformances
It doesn't mean anything yet, but parse it and make sure it reproduces
in the module interface.
2025-03-12 23:18:31 -07:00
Doug Gregor
3837661b84 [Isolated conformances] Allow conformance isolation to differ from the type's
With the move to explicitly specifying the global actor for an isolated
conformance, we can now have conformances whose isolation differs from
that of the type, including having actors with global-actor-isolated
conformances. Introduce this generalization to match the proposal, and
update/add tests accordingly.
2025-03-12 23:18:28 -07:00
Doug Gregor
71a516b5f7 Print isolated conformances in textual interfaces 2025-03-12 23:18:14 -07:00
Alejandro Alonso
d0513a7aec Merge pull request #79665 from Azoy/value-generics-no-more-experiment
[AST] Make ValueGenerics feature always available
2025-03-10 15:14:34 -07:00
Allan Shortlidge
6284dd4895 Sema: Downgrade diagnostics about unavailable requirements in swiftinterfaces.
Historically, we've allowed protocol requirements to be written with
`@_spi_available` which makes them unavailable to clients of the public
`.swiftinterface`. Don't diagnose this when checking a `.swiftinterface` since
there's nothing the client can do about it.

Resolves rdar://146334181.
2025-03-07 12:02:42 -08:00
Alejandro Alonso
c1bb143648 Make ValueGenerics feature always available 2025-02-27 10:03:37 -08:00
Slava Pestov
fa86097035 Merge pull request #79647 from slavapestov/fix-rdar139465298
AST: Fix TypeBase::hasSimpleTypeRepr() for ProtocolCompositionType
2025-02-26 23:02:48 -05:00
Slava Pestov
c4e804a7d1 AST: Fix TypeBase::hasSimpleTypeRepr() for ProtocolCompositionType
Prior to the introduction of noncopyable generics, a ProtocolCompositionType
was 'simple' if it was exactly 'Any' or 'AnyObject'. Now, there is a new
simple case, where we have a single inverse requirement '~Copyable' or
'~Escapable', and the old logic was never updated to account for this
possibility. Instead, it would ignore inverses, so it would claim that
a composition like `P & ~Copyable` was simple when it shouldn't be.

Fixes rdar://139465298.
2025-02-26 16:56:27 -05:00
Pavel Yaskevich
c3b75ee0ef Merge pull request #79580 from xedin/extensible-enums
[Serialization/TypeChecker] Introduce `ExtensibleEnums` feature
2025-02-25 09:53:02 -08:00
Alastair Houghton
4c0e141ccc Merge pull request #79390 from al45tair/eng/PR-144497613
[Backtracing] Add warning suppression option, enable it for tests.
2025-02-25 17:51:28 +00:00
Alexis Laferrière
c539f7e11a Merge pull request #79588 from xymus/ignore-more-swiftmodules
Frontend: Ignore resilient binary swiftmodules under usr/lib/swift
2025-02-25 09:08:36 -08:00
Alastair Houghton
71abe6f26b [Tests] Disable backtracing in some tests.
These tests can be negatively affected by the warnings about unsupported
Swift backtracer settings.

rdar://144497613
2025-02-25 10:53:28 +00:00
Pavel Yaskevich
b84bf055f0 [TypeChecker] Implement ExtensibleEnums feature exhaustivily handling
If an enum comes from a different module that has `ExtensibleEnums`
feature enabled, unless it requires either `@unknown default:` or
`@frozen` because it is allowed to introduce new cases in the future
versions of the module.
2025-02-25 00:05:23 -08:00
Alexis Laferrière
f6ef819ecf Frontend: Test that we still use the adjacent swiftmodule for the stdlib 2025-02-24 16:22:20 -08:00
Alexis Laferrière
40244a2935 Frontend: Ignore resilient binary swiftmodules under usr/lib/swift
Most SDKs use only swiftinterfaces under usr/lib/swift. Let's make sure
we standardize this behavior and use only swiftinterface when they are
present, even if there are also binary swiftmodule files available.

Apply the same logic to SubFrameworks as well while we're at it.

rdar://145316821
2025-02-24 16:22:20 -08:00
Tony Allevato
7c258f2057 Merge pull request #79485 from allevato/index-swiftinterface
[Frontend] Support `-index-store-path` for explicit module interface compilation.
2025-02-21 12:55:49 -08:00
Pavel Yaskevich
dd1be8f6d4 [Frontend] Hide @execution attribute behind an experimental feature ExecutionAttribute
Since the proposal has not been approved yet we cannot expose
`@execution` attribute.
2025-02-20 00:05:03 -08:00
Pavel Yaskevich
e2ff3308be [Frontend] NFC: Rename NonIsolatedAsyncInheritsIsolationFromContext feature
New name is `AsyncCallerExecution` as stated by the proposal.
2025-02-19 20:00:56 -08:00
Tony Allevato
5fd985256c [Frontend] Support -index-store-path for explicit module interface compilation. 2025-02-19 12:42:48 -05:00
Allan Shortlidge
9c15342d08 Sema: Allow unavailable stored properties in swiftinterfaces.
In a swiftinterface a declaration could be unavailable because it was written
in source with an `@_spi_available` attribute so it isn't possible to safely
reject unavailable stored properties in that context.

Resolves rdar://144958440.
2025-02-16 21:04:19 -08:00
Allan Shortlidge
d00e102fd1 Frontend: Remove the -skip-import-in-public-interface flag.
This flag is unsafe since the compiler does not verify that the resulting
public interface will compile with the module import removed. The modern
alternative to this flag is `@_spiOnly import`. Since the flag is no longer
used by any projects it should be removed.

Resolves rdar://134351088.
2025-02-09 18:52:10 -08:00
Meghana Gupta
98c7df228d Disable pre ossa modules tests 2025-01-30 17:10:04 -08:00
Erik Eckstein
830565b0f0 - test changes 2025-01-30 17:10:03 -08:00
Artem Chikin
5eb471730d Merge pull request #78867 from artemcm/NoPackageOnlyImportOnImplicitBuild
[ModuleInterface] Determine package-only resolution need based on input mode
2025-01-24 14:35:22 -08:00
Artem Chikin
a00c1ee7e5 [ModuleInterface] Determine package-only resolution need based on input mode
Instead of requested action. In implicit builds, implicit interface build sub-invocations inherit their parent invocation's requested action, which the code was failing to detect that we were building an interface, not source, and erroneously resulted in enabling in-package module dependency resolution.

Resolves rdar://143505814
2025-01-23 14:11:16 -08:00
Joe Groff
5d0fe0a156 Merge pull request #78705 from jckarter/explicit-conditional-invertible-extension-requirements
Require explicit statement of all `Copyable`/`Escapable` requirements for conditional `Copyable`/`Escapable` conformances.
2025-01-22 09:52:26 -08:00
Andrew Trick
5066dd9f90 Merge pull request #78716 from atrick/fix-lifedep-out
Fix LifetimeDependenceDiagnostics for @out dependencies
2025-01-22 00:17:50 -08:00
Joe Groff
a0a26b8330 Require explicit statement of all Copyable/Escapable requirements for conditional Copyable/Escapable conformances.
As specified by the SE-0446 acceptance, extensions that declare a type's
conditional `Copyable` or `Escapable` ability must reiterate explicitly all
of the `Copyable` and/or `Escapable` requirements, whether required or not
required (by e.g. `~Copyable`) that were suppressed in the original
type declaration.
2025-01-21 09:36:39 -08:00
Pavel Yaskevich
82e111a276 Merge pull request #78704 from xedin/rdar-142920095
Implement experimental`@execution(concurrent | caller)` attribute
2025-01-21 09:04:39 -08:00
Allan Shortlidge
17e2262449 Revert "AST: Print opaque result types correctly in swiftinterfaces."
This reverts commit 902892a59f.
2025-01-19 09:56:51 -08:00
Pavel Yaskevich
fc1e650b89 [Tests] NFC: Add serialization test for @execution(...) attribute 2025-01-17 15:40:01 -08:00
Andrew Trick
ffb1137348 Update lifetime_dependence tests for stricter diagnostics. 2025-01-17 11:19:04 -08:00
Allan Shortlidge
250479177e Merge pull request #78653 from tshortli/suppress-option-parsing-warnings-in-swiftinterfaces
Frontend: Honor warning suppression when parsing arguments from swiftinterfaces
2025-01-15 09:45:40 -08:00
Allan Shortlidge
3c5ae232dc Frontend: Honor warning suppression when parsing arguments from swiftinterfaces.
Diagnostics are suppressed when parsing swiftinterface files, since the
warnings emitted from compiling the swiftinterface of a dependency would just
be a nuisance. It follows that warnings generated when parsing the arguments in
a swiftinterface file should also be suppressed, but that wasn't happening
because the diagnostic engine of the main compile was used for parsing. Pass
the diagnostic engine of the compiler subinstance instead, and proactively
suppress warnings before parsing begins.

Resolves rdar://142814164.
2025-01-14 23:07:24 -08:00
Andrew Trick
0e33dfc8b6 Fix LifetimeDependence feature guard for variable accessors.
Guard variable declarations by `#if $LifetimeDependence` if they have a
~Escapable type. Accessing the declaration implies a lifetime dependence.
2025-01-14 15:41:58 -08:00
Joe Groff
4420f27e42 Merge pull request #78615 from jckarter/addressable-as-suppressable-feature
`AddressableTypes` should be a SUPPRESSIBLE_LANGUAGE_FEATURE.
2025-01-14 08:39:42 -08:00
Joe Groff
b9062195e6 AddressableTypes should be a SUPPRESSIBLE_LANGUAGE_FEATURE.
Types annotated as `@_addressableForDependencies` are still usable by older
compilers that don't know about nonescapable types or lifetime dependencies,
since it only affects the behavior of the type when it's the source of a
dependency.
2025-01-13 13:41:09 -08:00
Alejandro Alonso
09d122af7c Merge pull request #76438 from Azoy/vector
[stdlib] Slab
2025-01-12 10:36:25 -08:00
Allan Shortlidge
11abffb2f4 AST: Adopt new AvailableAttr constructor in attribute inference.
It was difficult to preserve the existing, buggy behavior of availability
attribute inference with respect to attributes specifying availability for
non-platform-specific domains. Instead, this change improves attribute merging
by tracking every domain independently, and only merging attributes from the
same domain.
2025-01-10 18:43:12 -08:00
Alejandro Alonso
f76d841540 Rename to Slab 2025-01-09 10:39:45 -08:00
Allan Shortlidge
7ea778f3a0 Sema: Diagnose @backDeployed functions with missing bodies in swiftinterfaces.
A `@backDeployed` function printed in a `.swiftinterface` must have a function
body so that SILGen can emit a fallback copy to call when the back deployed
function is unavailable. Previously, the compiler would crash in SILGen when
compiling an interface containing a back deployed function without a body.

Resolves rdar://141593108.
2025-01-03 09:15:12 -08:00