Commit Graph

603 Commits

Author SHA1 Message Date
Pavel Yaskevich
2a0651e8b0 [Frontend/NFC] SE-0400: Enable InitAccessors feature by default 2023-07-31 13:18:59 -07:00
Holly Borla
61e5811d73 [NFC] Update IDE, Index, ModuleInterface, and SourceKit tests to remove
conformance macros.
2023-07-19 12:38:52 -07:00
Doug Gregor
940870e92a Print "conformances" in extension macro role
Fixes rdar://112297735.
2023-07-17 13:47:05 -07:00
Slava Pestov
aa026f4d06 Merge pull request #67266 from slavapestov/transform-type-parameter-packs
Fix various places where we didn't handle "bound" pack references correctly
2023-07-13 08:09:04 -04:00
Xi Ge
45b5b4c13e Merge pull request #67269 from apple/block-list-note
ModuleLoader: emit a note when encountering a blocklisted module interface
2023-07-12 16:55:39 -07:00
Daniel Rodríguez Troitiño
70376a15f0 [ScanDependencies] Fix JSON generation under certain circunstances. (#67246)
The code of `ScanDependencies.cpp` was creating invalid JSON since #66031
because in the case of having `extraPcmArgs` and `swiftOverlayDependencies`,
but not `bridgingHeader`, a comma will not be added at the end of
`extraPcmArgs`, creating an invalid JSON file. Additionally that same PR
added a trailing comma at the end of the `swiftOverlayDependencies`, which
valid JSON does not allow, but that bug was removed in #66366.

Both problems are, however, present in the 5.9 branch, because #66936
included #66031, but not #66366.

Besides fixing the problem in `ScanDependencies.cpp` I modified every test
that uses `--scan-dependencies` to pass the produced JSON through
Python's `json.tool` in order to validate proper JSON is produced. In
most cases I was able to pipe the output of the tool into `FileCheck`,
but in some cases the validation is done by itself because the checks
depend on the exact format generated by `--scan-dependencies`. In
a couple of tests I added a call to `FileCheck` that seemed to be
missing.

Without these changes, two tests seems to be generating invalid JSON in
my machine:

- `ScanDependencies/local_cache_consistency.swift` (which outputs `Expecting ',' delimiter: line 525 column 11 (char 22799)`)
- `ScanDependencies/placholder_overlay_deps.swift`
2023-07-12 14:19:20 -07:00
Xi Ge
b697d40fb6 ModuleLoader: emit a note when encountering a blocklisted module interface 2023-07-12 13:53:36 -07:00
Slava Pestov
29415df860 ASTPrinter: Fix logic to determine if a requirement needs 'repeat' prefix 2023-07-12 12:34:37 -04:00
Artem Chikin
626c32b890 Merge pull request #67009 from Fushj89/inherit-strict-implicit-module-context-in-sub-swiftinterface
should inherit -strict-implicit-module-context when build sub swiftinterface
2023-07-05 12:48:23 -07:00
Ben Barham
1e3aaa57fc [Test] Re-enable distributed-actor
It was `distributed-actors.swift` failing, not
`distributed-actor.swift`. That commit has since been reverted.
2023-07-01 10:49:42 -07:00
Pavel Yaskevich
422fdaa55c Merge pull request #67054 from apple/revert-66852-wip-try-to-make-test
Revert "[Distributed] Try to make test for null sourcefile"
2023-06-30 17:41:31 -07:00
Doug Gregor
139672f854 Merge pull request #67055 from DougGregor/rename-observation-module
[SE-0395] Rename _Observation module to Observation
2023-06-30 13:45:16 -07:00
Steven Wu
94e8ddcf0b Merge pull request #67041 from cachemeifyoucan/eng/PR-fix-cas-depscan-edge-cases
[DepScan][CAS] Fix some cases in cas-based depscanning
2023-06-30 11:41:10 -07:00
Doug Gregor
6265f0c542 [SE-0395] Rename _Observation module to Observation
The review of SE-0395 is down to small details at this point that won't
affect the overall shape of the API much. Rename the model in
anticipation of that.
2023-06-30 11:01:02 -07:00
Pavel Yaskevich
bc9967e998 Revert "[Distributed] Try to make test for null sourcefile" 2023-06-30 10:21:37 -07:00
Steven Wu
dfd11cfec4 [DepScan] Add missing field in JSON output
SwiftSourceModule can contain "commandLine" field and add that into the
JSON output format.
2023-06-30 09:09:27 -07:00
Ben Barham
488026cd3a [Test] Temporarily disable test to unblock PR testing 2023-06-30 09:08:40 -07:00
Konrad `ktoso` Malawski
ab126c897c Merge pull request #66852 from ktoso/wip-try-to-make-test 2023-06-30 12:14:48 +09:00
fushijian
4b7b598128 should inherit -strict-implicit-module-context when build sub swiftinterface 2023-06-29 12:50:56 +08:00
Holly Borla
81a1f64811 [Macros] Allow @attached(extension) attributes to be suppressed in
module interfaces.
2023-06-28 14:53:16 -07:00
Doug Gregor
4b1a1e7b80 Merge pull request #66889 from DougGregor/init-accessor-stop-escaping-init
[ASTPrinter] Stop unnecessary escaping of `init` in macro role attributes
2023-06-23 12:43:42 -07:00
Doug Gregor
9606a9acfd [ASTPrinter] Stop unnecessary escaping of init in macro role attributes.
The excessive escaping of `init` in macro role attributes was a
workaround paired with https://github.com/apple/swift/pull/65442 to
smooth things over when working across Swift compiler versions.
However, it's causing problems for init accessors, so stop escaping.

Fixes rdar://111190084.
2023-06-23 10:18:26 -07:00
Konrad `ktoso` Malawski
a1b7aa5c9d [Distributed] Minimal test for round tripping through module with DA 2023-06-23 19:20:08 +09:00
Michael Gottesman
d0938a906f [move-only] Ban resilient noncopyable types.
One can still in resilient frameworks have noncopyable frozen types.

This means that one cannot make a noncopyable:

1. Full resilient public type.
2. @usableFromInline type.

NOTE: One can still use a frozen noncopyable type as a usableFromInline class
field. I validated in the attached tests that we get the correct code
generation.

I also eliminated a small bug in TypeCheckDeclPrimary where we weren't using a
requestified attr check and instead were checking directly.

rdar://111125845
2023-06-21 16:57:44 -07:00
Arnold Schwaighofer
99b5f1b5de Fix directory test/ModuleInterface 2023-06-20 13:15:09 -07:00
Arnold Schwaighofer
5d5dbd98a4 Merge pull request #66077 from aschwaighofer/wip_enable_opaque_pointers
Enable usage of LLVM's opaque pointer
2023-06-15 11:47:24 -07:00
Hamish Knight
3f401fb134 [test] Require asserts for a couple of tests 2023-06-15 12:28:55 +01:00
Arnold Schwaighofer
c1a93e0bde Move tests over to use the %use_no_opaque_pointers option 2023-06-14 10:49:48 -07:00
Ben Barham
183902da47 Merge pull request #66576 from bnbarham/ignore-host-modules
[Frontend] Ignore adjacent swiftmodule in compiler host modules
2023-06-14 09:38:20 -07:00
Saleem Abdulrasool
545334cf35 Merge pull request #66510 from tristanlabelle/fix-tests-windows-vs2022
Fix tests on Windows CI with VS2022
2023-06-14 08:49:42 -07:00
Ben Barham
ee3a47b624 [Frontend] Ignore adjacent swiftmodule in compiler host modules
`lib/swift/host` contains modules/libraries that are built by the host
compiler. Their `.swiftmodule` will never be able to be read, ignore
them entirely.
2023-06-12 16:53:48 -07:00
Doug Gregor
1209ef89ec Ensure that macros within init accessors are expanded early enough
Now that we've made accessor macro expansion more lazy, ensure that
when querying for init accessors (e.g., to build a memberwise
initializer), we also expand any accessor macros that might produce an
init accessor.

This is a partial step toward the real goal, which is that
`AbstractStorageDecl::getAccessor()` should lazily expand macros if
needed.

Update the Observable macro to document that it produces an `init`
accessor.
2023-06-11 08:48:43 -07:00
Doug Gregor
7fb1ba9798 [AST printer] Stop printing -> () types on all macro declarations. 2023-06-09 23:25:34 -07:00
Tristan Labelle
3c51106fad Fix tests on Windows CI with vs2022 2023-06-09 16:41:05 -04:00
Joe Groff
f06621907e SILGen: Don't copy a borrowed noncopyable address-only base of a computed property access.
We can probably avoid this copy in more circumstances, but make the change only for
noncopyable types for now, since that's the case where it's most semantically apparent.
rdar://109161396
2023-06-08 08:36:04 -07:00
Allan Shortlidge
17d121f7d1 Merge pull request #65954 from tshortli/swiftinterface-inlinable-function-availability-miscompile
Frontend: Don't append `-target-min-inlining-target target` to implicit module builds
2023-05-30 18:10:59 -07:00
Doug Gregor
eeede463fc [Test] Note that test requires observation to be built 2023-05-30 17:31:31 -07:00
Allan Shortlidge
0e7ad1e9a4 Frontend: Don't append -target-min-inlining-target target to implicit module builds.
When performing an implicit module build, the frontend was prepending
`-target-min-inlining-target target` to the command line. This was overriding
the implicit `-target-min-inlining-target min` argument that is implied when
`-library-level api` is specified. As a result, the wrong overload could be
picked when compiling the body of an inlinable function to SIL for emission
into the client, potentially resulting in crashes when the client of the module
is back deployed to an older OS.

Resolves rdar://109336472
2023-05-30 13:33:26 -07:00
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