Commit Graph

1116 Commits

Author SHA1 Message Date
Allan Shortlidge
3a02629be4 Frontend: Make lazy typechecking a TC opt instead of a frontend action. 2023-08-28 08:28:56 -07:00
Doug Gregor
ff8a1be972 [Swift interface] Print declarations produced by declaration macro expansion
Don't print the uses of freestanding declaration macros in Swift
interfaces. Instead, print the declarations they produce, as
appropriate.

Fixes rdar://113730928.
2023-08-21 23:31:47 -07:00
Allan Shortlidge
c05b3e4d66 Tests: Adopt -experimental-lazy-typecheck in tests.
Also, restructure the `CHECK:` lines for the `-emit-tbd` test. The number of
columns in the `.tbd` file appears to be variable, so we can't assume a layout
for the symbols in the YAML.
2023-08-18 16:29:56 -07:00
Slava Pestov
c2f1193ae3 Merge pull request #67952 from slavapestov/tuple-conformance-tbd-etc
A pile of mostly unrelated one-liners
2023-08-18 15:31:26 -04:00
Slava Pestov
eadffd3c6c AST: Don't look at PatternBindingDecl in usesBuiltinType()
Type-checking patterns is not fully requestified, so the
ASTPrinter should not assume this has been filled in.

It appears sufficient to just visit the associated VarDecl,
as we do already.
2023-08-18 12:12:50 -04:00
Slava Pestov
010415f4f3 Sema: Force destructor synthesis in evaluateMembersRequest() 2023-08-18 12:12:50 -04:00
Allan Shortlidge
9ecb6b4657 Merge pull request #67980 from tshortli/stop-ignoring-me
Frontend: Migrate several options to no longer be ignorable in swiftinterfaces
2023-08-17 09:51:18 -07:00
Allan Shortlidge
5c762b1435 Frontend: Migrate several options to no longer be ignored in swiftinterfaces.
Frontend options should only be printed under `swift-module-flags-ignored:`
temporarily to prevent condfails for older development compilers that are still
in use (as a rule of thumb, swiftinterfaces should be compatible with compilers
that are up to 6 months old). None of the frontend flags that are currently
categorized as "ignorable" need to be ignorable anymore.
2023-08-16 20:57:50 -07:00
Slava Pestov
21090519a4 Frontend: Allow -emit-module-interface with -resolve-imports
Experimental mode for generating module interfaces without running
primary file type-checking. The idea is that the ASTPrinter triggers
requests to only do the minimum amount of type checking work
possible while printing the interface for a module's public
declarations.

These requests may emit diagnostics, but the ASTPrinter should in
theory already be robust against invalid code.
2023-08-15 19:59:12 -04:00
Pavel Yaskevich
4bd60aeb4e [Tests] NFC: Remove/adjust runtime metadata related test cases 2023-08-15 12:17:31 -07:00
Kavon Farvardin
4e7e6f41cb remove support for _forget, the old spelling of discard
resolves rdar://112549258
2023-08-11 15:42:25 -07:00
Allan Shortlidge
7bb2d82f19 NFC: Update lit.cfg to specify -parse-as-library for module interface tests.
Tests that use the `%target-swift-emit-module-interface` lit substitution are
designed to test the behavior of the compiler when emitting module interfaces
for resilient libraries. It therefore makes sense to pass `-parse-as-library`
by default for these frontend invocations.

Fixes a few tests that were accidentally depending on parsing source files as
top level code.
2023-08-09 14:24:11 -07:00
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