Commit Graph

1116 Commits

Author SHA1 Message Date
Hamish Knight
e03bd0a15d [test] Fully disable moveonly_interface.swift 2023-05-30 09:54:31 +01:00
Dario Rexin
2ea162b9d6 [Test] Use production available features in option-filtering.swift (#66127)
rdar://109832161

Some features used in this test were not available in production compilers, causing build failures.
2023-05-25 22:29:32 -07:00
Doug Gregor
7d0510a1bf Merge pull request #66131 from DougGregor/interfaces-without-macros 2023-05-25 21:07:12 -07:00
Doug Gregor
548ff3a0b2 [Test] Ensure that a class using the Observable macro builds a proper interface 2023-05-25 13:59:41 -07:00
Dario Rexin
670f5d2457 [Test] Improve interface option filter test (#66102) 2023-05-24 15:29:48 -07:00
Dario Rexin
2bb08e37f6 [ModuleInterface] Add mechanism to exclude experimental flags from th… (#66088)
* [ModuleInterface] Add mechanism to exclude experimental flags from the module interface

rdar://109722548

* Separate filtered flags from the typical/unfiltered case
2023-05-24 09:03:01 -07:00
Tristan Labelle
d0ba4ced4b tests: Fix module loading prefer-serialized test failure on Windows
Fixes three tests failing on Windows:

```
  Swift(windows-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift
  Swift(windows-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift
  Swift(windows-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode.swift
```

These test cases remove read access to the `.swiftmodule` . The expected
behavior is that the compiler checks `fs.exists("path-to.swiftmodule")`
, determines that the file exists and chooses to use it instead of the
`.swiftinterface`. Compilation then fails because the file cannot be
read.

e22cf2e993/lib/Frontend/ModuleInterfaceLoader.cpp (L752)

On Windows, we were denying `R` access, which is broader than only read
access to file contents but also includes file attributes and
permissions. This caused `fs.exists` to fail since it relies on
`fs.status`, which could not open the file with `CreateFileW`. The fix
is is to only deny `RD - read data/list directory` access.
2023-05-16 14:56:40 -07:00
Slava Pestov
e9e6a51c82 Unconditionally enable variadic generic types now that SE-0398 has been accepted 2023-05-15 23:32:52 -04:00
Slava Pestov
4318a36be6 Sema: Availability checking for variadic generic types 2023-05-12 22:50:25 -04:00
nate-chandler
4d8dab00f8 Merge pull request #65845 from nate-chandler/eagermove_language_feature
[AST] Added language feature for @_eagerMove.
2023-05-11 08:31:25 -07:00
Nate Chandler
b72395814b [AST] Added language feature for @_eagerMove.
The new LexicalLifetimes suppressible language feature results in
declarations annotated with @_eagerMove, @_noEagerMove, and
@_lexicalLifetimes to be printed with that attribute when it's available
and without it when it's not.
2023-05-10 18:19:49 -07:00
Kavon Farvardin
511eb44025 Merge pull request #65787 from kavon/forget-to-discard
rename `_forget` to `discard`; deprecate `_forget`
2023-05-09 07:30:49 -07:00
Kavon Farvardin
3e4bc82aa8 rename _forget to discard; deprecate _forget
SE-390 concluded with choosing the keyword discard rather than forget for
the statement that disables the deinit of a noncopyable type. This commit
adds parsing support for `discard self` and adds a deprecation warning for
`_forget self`.

rdar://108859077
2023-05-08 21:42:19 -07:00
Allan Shortlidge
4a84ddb230 AST: Print official spelling of @backDeployed attr in swiftinterfaces.
It's no longer necessary to support compilers that only parse the
`@_backDeploy` spelling.

Resolves rdar://104920183
2023-05-08 13:56:52 -07:00
Eric Miotto
6235aa8e5c Configure ModuleInterface/arm64e-fallback to not run in simulators
This would be needed to avoid test failures when running the test suite
on an Apple Silicon machine.

Addresses rdar://108788721
2023-05-03 14:33:19 -07:00
Allan Shortlidge
020987a567 Macros: Escape init when printing names for attached macros.
Older compilers can't parse `name(init)`. Restore the call to
`escapeKeywordInContext()` to ensure special names get escaped.

Resolves rdar://108806697
2023-05-02 17:43:04 -07:00
Allan Shortlidge
949612553a Merge pull request #65568 from tshortli/expression-attr-condfail
Revert #64269
2023-05-02 13:13:52 -07:00
Allan Shortlidge
dd5b934a41 Tests: Small updates to ModuleInterface/macros.swift test. 2023-05-01 19:44:57 -07:00
Allan Shortlidge
ffaa1d5dbc Revert "[Macros] Treat FreestandingExpressionMacros as a suppressible feature"
This reverts commit b412c6c884.

Resolves rdar://108591384
2023-05-01 19:44:39 -07:00
Kavon Farvardin
ee819c80a9 Build support for ~Copyable atop @_moveOnly
We parse `~Copyable` in an inheritance clause of enum and
struct decls as a synonym for the `@_moveOnly` attribute
being added to that decl. This completely side-steps the
additional infrastructure for generalized suppressed
conformances in favor of a minimal solution. One benefit of
this minimal solution is that it doesn't risk introducing
any back-compat issues with older compilers or stdlibs.

The trade-off is that we're more committed to supporting
`@_moveOnly` in compiled modules in the future. In fact,
this change does not deprecate `@_moveOnly` in any way.

resolves rdar://106775103
2023-05-01 14:36:39 -07:00
Allan Shortlidge
0e9b8a1e0a Sema: Relax distributed actor typechecking for swiftinterfaces.
Some decls that are expected to be synthesized for distributed actors are
printed explicitly in swiftinterfaces so diagnostics and assertions need to
take that possibility into account.

Resolves rdar://108533918
2023-04-26 08:44:44 -07:00
Doug Gregor
ae4a5ded8f [Macros] Improve parsing, representation, and serialization of role attributes
Parse compound and special names in the macro role attributes
(`@freestanding` and `@attached`). This allows both compound names and
initializers, e.g., `init(coding:)`.

Fixes rdar://107967344.
2023-04-21 11:36:06 -07:00
Slava Pestov
df5d531dc6 ASTPrinter: Fix printing of pack requirements
Also remove the flag for printing 'each' and make it always on.
2023-04-19 13:04:51 -04:00
Allan Shortlidge
8ee6d43876 Merge pull request #65023 from tshortli/exclusivity-attribute-in-swiftinterface
Sema: Skip storage diagnostic for `@exclusivity` in swiftinterfaces
2023-04-10 15:06:48 -07:00
Xi Ge
63e2b2e7b7 ModuleInterface: add a block list action to downgrade module interface verification errors to warnings 2023-04-08 22:15:41 -07:00
Allan Shortlidge
7ba9601e64 Sema: Skip storage diagnostic for @exclusivity in swiftinterfaces.
Relax the diagnostics for the `@exclusivity` attribute in order to avoid type
checking failures for `public private(set)` properties in resilient libraries.
In a `swiftinterface` it's not possible to tell reliably whether a property has
storage.

Resolves rdar://107770440
2023-04-07 21:23:27 -07:00
Slava Pestov
093fa282b0 Guard usage of variadic generics with $ParameterPacks in module interface files
Fixes rdar://107559541.
2023-04-03 19:49:39 -04:00
Saleem Abdulrasool
deed57cefe Merge pull request #64721 from tristanlabelle/fix-lit-python-test-failure-backslash
Fix test failure on Windows due to path separators being treated as escapes
2023-03-31 11:29:27 -07:00
Doug Gregor
7c7459ac6b Merge pull request #64641 from DougGregor/macro-replacement-expansion 2023-03-29 20:47:30 -07:00
Doug Gregor
68b367b266 Disable macros-related tests harder 2023-03-29 16:32:32 -07:00
Doug Gregor
30f17940f9 Require the Swift swift parser for a few tests affected by macros 2023-03-29 16:32:32 -07:00
Doug Gregor
cfbdae586d [Macros] Add a test ensuring that we print expanded macro definitions
This should complete the implementation of expanded macro
definitions, rdar://104044325.
2023-03-29 16:32:32 -07:00
Allan Shortlidge
f4b79594a8 Tests: Fix and re-enable @_spi_available tests
The main issue was that the tests specified `-library-level=api` in
`swift-frontend` invocations instead of `-library-level api`. The former seems
to have no effect and therefore expected diagnostics were not being emitted.

Additional clean up:
- Make every test require `OS=macosx` for ease of local testing.
- Avoid unnecessarily specifying target arches (this makes tests slow).
- Add missing `FileCheck` invocation.
- Add some missing test coverage.

Resolves rdar://91325474
2023-03-29 14:45:22 -07:00
Tristan Labelle
8155f07ca6 Fix test failure on Windows due to path separators being treated as escapes 2023-03-29 12:03:43 -04:00
Dario Rexin
45b8cfd511 [ModuleInterface] Guard layout based prespecializations in swiftinter… (#64695)
* [ModuleInterface] Guard layout based prespecializations in swiftinterface files

rdar://107269447

To allow compilers that don't have this feature enabled to parse interface files that contain declarations that use layout based prespecializations, it has to be guarded.

* Incorporate feedback
2023-03-28 22:43:45 -07:00
Alexis Laferrière
d707dc4d81 Merge pull request #64516 from xymus/remark-transitive
[Serialization] Remark on transitive dependencies and loading requirement
2023-03-28 09:18:07 -07:00
Alexis Laferrière
bf2d2475f3 [Serialization] Remark on transitive dependencies 2023-03-27 10:04:03 -07:00
Becca Royal-Gordon
ab5d3ac42c [NFC] Verify ModuleInterface/objc_implementation
Switch the ModuleInterface/objc_implementation.swift test to using standard substitutions to properly emit its module interface, and make sure it also verifies.
2023-03-25 14:53:29 -07:00
Becca Royal-Gordon
e8c43bb168 Fix @objcImpl subclass init visibility computation
When writing an @objc subclass of an @objcImplementation class, implicit initializers in the subclass were treated as overriding the *implementation decl*, not the *interface decl*, of the initializer in the superclass. This caused Swift to incorrectly compute the visibility of the superclass initializer and omit an `override` keyword from the module interface when one would definitely be necessary.

Correct this oversight by looking up the interface decl matching the superclass implementation in `collectNonOveriddenSuperclassInits()`.
2023-03-25 14:53:29 -07:00
Becca Royal-Gordon
04a27b822c Omit @objcImpl from module interfaces
Module interfaces should not include the @objcImplementation attribute, member implementations that are redundant with the ObjC header, or anything that would be invalid in an ordinary extension (e.g. overridden initializers, stored Swift-only properties).
2023-03-25 14:53:29 -07:00
Kavon Farvardin
bf7091f046 ensure #if $MoveOnly evaluates to true
I enabled move-only types by default, but I didn't
realize that the `Feature::MoveOnly` needs to graduate
into a `LANGUAGE_FEATURE` so that `EvaluateIfConfigCondition`
will recognize `$MoveOnly` as being true.

fixes rdar://107050387
2023-03-24 08:48:26 -07:00
Allan Shortlidge
5da4e2df40 Sema: Allow unavailable decls to witness requirements in more conformances.
In https://github.com/apple/swift/pull/63898 conformance requirement
typechecking was relaxed to allow unavailable decls to witness conformance
requirements as long as the conforming nominal was also unavailable. However,
only nominals that were directly marked unavailable were accepted. Nominals
that are declared in unavailable scopes should also be allowed to have
unavailable wintesses.

Resolves rdar://107052715
2023-03-22 12:37:51 -07:00
swift-ci
fd0f148a07 Merge pull request #64518 from artemcm/NoExtraClangPCMSearchPaths
[Dependency Scanning] Do not add extra search paths to the Clang's explicit PCM prebuild commands
2023-03-22 11:51:46 -07:00
Nate Chandler
2d19632d88 [Test] Fully disabled test.
It's failing on more platforms than originally thought.

rdar://107052715
2023-03-22 10:26:27 -07:00
Artem Chikin
4ed874c276 [Dependency Scanning] Do not add extra search paths to the Clang's explicit PCM prebuild commands
Clang dependency scanner's output will be complete here w.r.t. the required search paths.

Resolves rdar://107018240
2023-03-22 09:36:17 -07:00
Konrad `ktoso` Malawski
11decb017f disable actor_availability on ios 2023-03-22 22:54:22 +09: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
Alexis Laferrière
3e79583e4e Merge pull request #64404 from xymus/access-level-import-tests
[Sema] Reenable two access-level on imports tests
2023-03-16 12:56:33 -07:00
Kavon Farvardin
a8a44ebb17 Merge pull request #64106 from kavon/enable-moveonly-by-default
Enable moveonly / noncopyable types by default
2023-03-15 09:59:29 -07:00
Kavon Farvardin
2c7d9a5047 update tests given move-only types are enabled
the main things still left behind the experimental flag(s) are
- move-only classes (guarded by MoveOnlyClasses feature)
- noimplicitcopy
- the _borrow operator
2023-03-14 18:35:13 -07:00