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`
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.
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.
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
`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.
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.
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
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
* [ModuleInterface] Add mechanism to exclude experimental flags from the module interface
rdar://109722548
* Separate filtered flags from the typical/unfiltered case
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.
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.