Commit Graph

22435 Commits

Author SHA1 Message Date
Doug Gregor
34c020d5f4 Revert "Emit mangled names for public symbols into the .swiftinterface"
This reverts commit 0aff85ced7.
2024-11-12 22:38:47 -08:00
Allan Shortlidge
239720897a AST: Rename TypeRefinementContext to AvailabilityScope. 2024-11-12 11:34:25 -08:00
nate-chandler
359f898bbf Merge pull request #77546 from nate-chandler/general-coro/20241110/1
[CoroutineAccessors] Ban read+_read and modify+_modify.
2024-11-12 10:40:52 -08:00
Hamish Knight
b644cd87a9 [Sema] Ensure performStmtDiagnostics is called for CaseStmts
Previously we would check if we have a SwitchStmt,
and apply diagnostics such as `checkExistentialTypes`
to the CaseStmts individually. This however would
have been missed for `catch` statements. The change
to consistently call `performStmtDiagnostics` in
closures fixed this for `do-catch`'s in closures,
this commit fixes it for those outside of closures.
Because this is source breaking, the existential
diagnostic is downgraded to a warning until Swift
7 for catch statements specifically.

While here, also apply the ambiguous where clause
diagnostic to `catch` statements.
2024-11-12 18:26:54 +00:00
Allan Shortlidge
0b4693d1e8 Merge pull request #77550 from tshortli/opaque-return-type-printing 2024-11-12 07:20:42 -08:00
Hamish Knight
36a9628b9e Merge pull request #77537 from hamishknight/complete-func
[Completion] Type-check parent closures for local functions
2024-11-12 10:40:53 +00:00
Doug Gregor
dd7ec7fc57 Merge pull request #77532 from DougGregor/experimental-flag-for-span-usage
Temporarily put uses of "Span" and "RawSpan" behind an experimental feature flag
2024-11-12 01:35:42 -08:00
Allan Shortlidge
902892a59f AST: Print opaque result types correctly in swiftinterfaces.
Fixes a bug where references to the opaque types of other decls were printed
with the `some Type` syntax, breaking the interface. Only the opaque type
introduced by a declaration should be printed with the `some Type` syntax;
other opaque types must always be printed as a stable addresses instead.

Resolves rdar://134582913.
2024-11-11 21:52:27 -08:00
Doug Gregor
931614c155 Merge pull request #77547 from DougGregor/unsafe-diagnostic-group
Put warnings about unsafe constructs into a new diagnostic group `Unsafe`
2024-11-11 21:35:21 -08:00
Nate Chandler
de86cc037c [CoroutineAccessors] Tweak diags for old accessors
When the feature is enabled, refer to the old accessors as they are
actually spelled (i.e. `_read` and `_modify`).
2024-11-11 18:34:01 -08:00
Doug Gregor
7ffa5c324d Put warnings about unsafe constructs into a new diagnostic group Unsafe 2024-11-11 17:50:21 -08:00
Doug Gregor
531a1ab4c4 Temporarily put uses of "Span" and "RawSpan" behind an experimental feature flag
While Span is present, we don't yet have an official way to create Span
instances. Until then, put uses of Span and RawSpan behind an
experimental feature flag (`Span`) that must be set to use these.

Addresses rdar://139308307.
2024-11-11 16:18:33 -08:00
Rintaro Ishizaki
4bb507d943 Merge pull request #77533 from rintaro/astgen-closure-signature
[ASTGen] Generate closure signatures
2024-11-11 16:06:50 -08:00
Doug Gregor
cf68d28400 Merge pull request #76951 from kovdan01/issue60102
[AutoDiff] Enhance performance of custom derivatives lookup
2024-11-11 14:55:54 -08:00
Rintaro Ishizaki
0ba92d84e5 [ASTGen] Generate closure signatures
Still TODO:
* Capture list
* Anonymous parameters
2024-11-11 12:21:38 -08:00
Hamish Knight
7beceb0e4b [AST] Generalize getInnermostClosureForSelfCapture
Really this applies to any capture, not just
`self`. Also refactor to make it clear that
parent closures and functions are really the only
cases that matter here.
2024-11-11 19:34:21 +00:00
Hamish Knight
f9ff0c5a6c [AST] NFC: Add doc comment for isSynthesized
Make it clear why this is a different bit to
`isImplicit`.
2024-11-11 13:21:24 +00:00
Doug Gregor
f64189043a Merge pull request #77517 from DougGregor/rtc-macro-expansion
Teach the TypeRefinementContext not to skip declarations within macro expansions
2024-11-10 16:43:15 -08:00
nate-chandler
aab880da05 Merge pull request #77429 from nate-chandler/general-coro/20241104/1
[CoroutineAccessors] Synthesize default requirement implementations.
2024-11-10 07:43:11 -08:00
Doug Gregor
de4d4a4244 Teach the TypeRefinementContext not to skip declarations within macro expansions
The construction of type refinement contexts performs lazy expansion
for the contents of macro expansions, so that TRC creation doesn't
force all macros to be expanded. However, the logic that skips macro
expansions would *also* skip some declarations produced within a macro
expansion, even when building the TRC specifically for that macro
expansion buffer. This manifest as missing some availability
information within the TRC, rejecting some well-formed code.

Tune the logic for "don't visit macro expansions when building a TRC"
to recognize when we're building a TRC for that macro expansion.

Fixes rdar://128400301.
2024-11-10 07:32:00 -08:00
Holly Borla
dc01137314 Merge pull request #77459 from hborla/preconcurrency-downgrade
[Concurrency] Fix preconcurrency downgrade behavior for `Sendable` closures and generic requirements.
2024-11-09 07:18:50 -08:00
Arnold Schwaighofer
08b3c95883 Merge pull request #77452 from aschwaighofer/enable_async_metadata
IRGen: Enable EmitAsyncFramePushPopMetadata per default
2024-11-08 15:21:58 -08:00
Slava Pestov
fcd6985c53 Merge pull request #77463 from slavapestov/fix-rdar139089004
AST: Add workaround for incorrect mangling of conditional conformances with pack requirements
2024-11-08 10:45:14 -05:00
Nate Chandler
da71271d8f [CoroutineAccessors] Synthesize default req impls.
When a protocol which has a read (or modify) requirement is built with
the CoroutineAccessors feature, it gains a read2 (or modify2,
respectively) requirement.  For this to be compatible with binaries
built without the feature, a default implementation for these new
requirements must be provided.  Cause these new accessor requirements to
have default implementations by returning `true` from
`doesAccessorHaveBody` when the context is a `ProtocolDecl` and the
relevant availability check passes.
2024-11-07 16:47:09 -08:00
Konrad `ktoso` Malawski
b5964a05a5 Merge branch 'main' into revert-77364-mpokhylets/non-experimental-isolated-deinit 2024-11-08 09:03:21 +09:00
Holly Borla
d2d317a3d7 [Concurrency] Fix preconcurrency downgrade behavior for Sendable closures.
Sendable violations inside `@preconcurrency @Sendable` closures should be
suppressed in minimal checking, and diagnosed as warnings under complete
checking, including the Swift 6 language mode.
2024-11-07 16:02:37 -08:00
Alex Hoppen
fb0b3fa90c Merge pull request #77149 from Azoy/swift-syntax-integer-types
[ASTGen/Parse] Implement ASTGen changes for integer generics from Swift Syntax and restrict parsing integer types in certain contexts
2024-11-07 14:04:26 -08:00
Slava Pestov
69e3aaf6fe AST: Add workaround for incorrect mangling of conditional conformances with pack requirements
I added commit 7eecf97132 a while ago
to fix a newly-added assertion failure that came up, however this
had the inadvertent side effect of changing symbol mangling and
ASTPrinter behavior.

The problem in both instances was that we would incorrectly return
certain requirements as unsatisfied when really they are satisfied.

There is nothing to fix in the ASTPrinter, because printing redundant
requirements does not change the generic signature of the extension;
they are simply dropped. I added a test to exercise the new behavior
showing that the requirements are dropped.

As for the mangler, the fix introduced an ABI break, because the
symbol name of a conformance descriptor includes its conditional
requirements, so we must preserve the redundant requirements forever.
The IRGen test has some examples of manglings that are incorrect but
must be preserved.

I'm plumbing down a flag to isRequirementSatified() to preserve
compatibility with the old behavior where we would mangle these
redundant requirements. No other callers should pass this flag,
except for the mangler.

Fixes rdar://139089004.
2024-11-07 16:28:26 -05:00
Arnold Schwaighofer
fdc6c4ccd8 IRGen: Enable EmitAsyncFramePushPopMetadata per default
rdar://136292425
2024-11-07 08:42:04 -08:00
Antonio Frighetto
377c03fa7e [Driver][Frontend] Introduce load-pass-plugin option
Allow dynamic loading of LLVM passes via `load-pass-plugin`
option passed to the Swift compiler driver.
2024-11-07 17:25:24 +01:00
Nate Chandler
8995602107 [NFC] Promote static to member function. 2024-11-06 20:52:21 -08:00
Nate Chandler
f1f0ccdeff [NFC] Improved predicate names. 2024-11-06 20:52:21 -08:00
Doug Gregor
64e08d7e47 Merge pull request #77436 from DougGregor/parse-expression-macro-buffer-as-expression 2024-11-06 20:25:49 -08:00
Konrad `ktoso` Malawski
aadc67ec0e Revert "Make IsolatedDeinit non-experimental" 2024-11-07 09:59:00 +09:00
Doug Gregor
78b89b201c Parse expression macro expansion buffers as expressions
This started out as a crash, where an expression macro could not be
defined in terms of one of the builtin macros (e.g., `#line`), because
we were expecting a macro expansion expression but didn't get one.
Easy fix.

However, this uncovered a second bug, which is that we couldn't handle
an expression macro expansino to `#line`. This is because we were
parsing the macro expansion buffer as "top level items", which treats
`#line` at the start of a line as a deprecated alias of
`#sourceLocation`. Switch over to parsing a single expression in these
contexts, and fix up an issue where `#isolation` didn't even have that
expression.

Fixes rdar://139372780.
2024-11-06 15:55:38 -08:00
Alejandro Alonso
ba3bc1d5f1 Implement ASTGen changes for integer generics from Swift Syntax
Support negatives
2024-11-06 13:54:59 -08:00
Arnold Schwaighofer
34c417d9ff Merge pull request #77379 from aschwaighofer/enable_aggressive_reg2mem
Enable heuristic that tries to keep large values in memory
2024-11-06 11:36:33 -08:00
Allan Shortlidge
b345418eca Merge pull request #77408 from tshortli/revert-package-fixes
Revert removal of `-package-name` from swiftinterfaces
2024-11-06 10:31:34 -08:00
Rintaro Ishizaki
47f27a411c Merge pull request #77398 from rintaro/astgen-keypathexpr
[ASTGen] Generate Swift key-path expressions
2024-11-06 10:15:37 -08:00
Konrad `ktoso` Malawski
52d55a1426 Merge pull request #77364 from nickolas-pohilets/mpokhylets/non-experimental-isolated-deinit 2024-11-06 11:49:07 +09:00
Allan Shortlidge
49b59f69c9 Revert https://github.com/swiftlang/swift/pull/75745.
Finishes resolving rdar://139236053.
2024-11-05 14:37:56 -08:00
Rintaro Ishizaki
dc156a644a [ASTGen] Generate Swift key-path expressions 2024-11-05 13:38:21 -08:00
Rintaro Ishizaki
e566a746c8 [ASTGen] Support macro expanded buffer
* Make ExportedSourceFile hold any Syntax as the root node
* Move `ExportedSourceFileRequest::evaluate()` to `ParseRequests.cpp`
* Pass  the decl context and `GeneatedSourceFileInfo::Kind` to
  `swift_ASTGen_parseSourceFile()` to customize the parsing
* Make `ExportedSourceFile` to hold an arbitrary Syntax node
* Move round-trip checking into `ExportedSourceFileRequest::evaluate()`
* Split `parseSourceFileViaASTGen` completely from C++ parsing logic
  (in `ParseSourceFileRequest::evaluate()`)
* Remove 'ParserDiagnostics' experimental feature: Now that we have
  ParserASTGen mode which includes the swift-syntax parser diagnostics.
2024-11-05 11:00:33 -08:00
Allan Shortlidge
919ec930f9 Merge pull request #77384 from tshortli/rename-unmet-availability-requirement 2024-11-05 10:56:55 -08:00
Artem Chikin
8e3a6207b9 Merge pull request #76915 from artemcm/AsyncScanExperiment
[Dependency Scanning] Parallelize Clang module queries
2024-11-05 10:04:31 -08:00
Michael Gottesman
2503384c43 Merge pull request #77370 from gottesmm/transfer_to_send
[region-isolation] Excise 'transfer' in favor of 'sending'
2024-11-05 06:29:58 -08:00
Mykola Pokhylets
c139d1b1a7 Make IsolatedDeinit non-experimental 2024-11-05 12:19:01 +01:00
Allan Shortlidge
4fa02cd11a AST: Rename UnmetAvailabilityRequirement to AvailabilityConstraint.
Also, pull its definition out into a separate header.
2024-11-04 19:58:28 -08:00
Hamish Knight
36f2f46c83 Merge pull request #77345 from hamishknight/opaque-cache
[AST] Use cached deserialized decl in `getOpaqueResultTypeDecl`
2024-11-05 00:17:39 +00:00
Michael Gottesman
32b4de60a9 Rename transfer -> send.
Accomplished using clangd's rename functionality.
2024-11-04 15:17:51 -08:00