Commit Graph

21504 Commits

Author SHA1 Message Date
Konrad `ktoso` Malawski
09003d6f11 Revert "Merge pull request #77609 from ktoso/wip-task-names" (#79562)
This reverts commit 4ab5d2604f.
2025-02-23 22:59:21 -08:00
Doug Gregor
50801f9c05 [SE-0458] Implement "unsafe" effect for the for-in loop
Memory unsafety in the iteration part of the for-in loop (i.e., the part
that works on the iterator) can be covered by the "unsafe" effect on
the for..in loop, before the pattern.
2025-02-23 22:50:39 -08:00
Allan Shortlidge
db29a1c6f4 Parse/Sema: Move #available query wildcard diagnostics to Sema.
In order to unblock resolution of availability domains during type-checking
instead of parsing, diagnostics about missing or superfluous wildcards in
availability specification lists need to move to Sema.
2025-02-23 22:09:33 -08:00
Allan Shortlidge
eb6506a1ad AST: Introduce SemanticAvailabilitySpec.
It wraps an type-checked `AvailabilitySpec`, which guarantees that the spec has
a valid `AvailabilityDomain` associated with it. This will unblock moving
AvailabilitySpec domain resolution from parsing to sema.
2025-02-23 10:53:06 -08:00
Allan Shortlidge
5bccbe567d AST: Refactor AvailabilityScope::getAvailabilityConditionVersionSourceRange().
Modify it to take an `AvailabilityDomain` and a `DeclContext` which will be
necessary in order to compare `AvailabilitySpec`s in a later refactor.
2025-02-23 10:53:06 -08:00
stzn
43e60304ad Add sending to subscript getter sending result 2025-02-23 10:52:01 +09:00
Allan Shortlidge
b2c57f8119 AST: Canonicalize AvailableAttr versions on-demand.
Translate macOS 10.16 to macOS 11 on-demand when calling
`SemanticAvailableAttr` version accessors. This removes the need for
`AvailableAttr` to have mutable version members that
`SemanticAvailableAttrRequest` can update.
2025-02-22 09:40:24 -08:00
Rintaro Ishizaki
4160f101ad [ASTGen] Generate @_unavailableInEmbedded attribute
Which is a sugar of '@available(*, unavailable)' when Embedded feature
is enabled.
2025-02-21 16:54:09 -08:00
Pavel Yaskevich
0004a4b5db [NameLookup] Shadowing: strip @Sendable annotations for declarations ObjC/@objc declarations
When `SendableCompletionHandlers` feature is enabled, ClangImporter
is going to inject `@Sendable` attribute into the completion handler
parameter's function type. We need to make sure that his new behavior
doesn't break shadowing rules and allow APIs to annotate their ObjC
declarations with `@Sendable` without breaking clients.
2025-02-21 14:19:29 -08:00
Rintaro Ishizaki
efea164d04 [ASTGen] Generate from 'MissingTypeSyntax'
Just emit ErrorTypeRepr
2025-02-21 11:36:29 -08:00
Rintaro Ishizaki
f48282c92b [ASTGen] Generate trailing where clause for SubscriptDecl
It was just missing.
2025-02-21 11:36:29 -08:00
Rintaro Ishizaki
aae50a88c5 [ASTGen] Fix expanded macro buffer parsing and AST generation
Parse expanded buffer into dedicated syntax.

Also rename `BridgedGeneratedSourceFileKindAttribute` to
`BridgedGeneratedSourceFileKindAttributeFromClang` because C++ decl
(i.e. `GeneratedSourceInfo::Kind::AttributeFromClang`) was renamed a
while ago.
2025-02-21 09:56:36 -08:00
Pavel Yaskevich
520c05b1b8 Merge pull request #79508 from xedin/feature-proof-execution-attrs
[Frontend] Rename `NonIsolatedAsyncInheritsIsolationFromContext` feature and add a feature for `@execution`
2025-02-21 09:07:04 -08:00
Konrad `ktoso` Malawski
4ab5d2604f Merge pull request #77609 from ktoso/wip-task-names
[Concurrency] Task names
2025-02-21 22:28:33 +09:00
Rintaro Ishizaki
6805e155d5 Merge pull request #79503 from rintaro/astgen-paramdecl-typerepr
[AST] Sink ParamDecl flag collection logic from Parse to AST
2025-02-21 02:18:52 -08:00
Allan Shortlidge
b20f2c0e4e Merge pull request #79517 from tshortli/availability-scope-decl-context
AST: Store the active `DeclContext` in `AvailabilityScope`
2025-02-20 20:07:57 -08:00
Allan Shortlidge
3db2b97a83 Merge pull request #79520 from tshortli/sink-semantic-available-attr-request
AST/Sema: Sink `SemanticAvailableAttrRequest` from Sema into AST
2025-02-20 20:00:13 -08:00
Pavel Yaskevich
7484f01f8e Merge pull request #79504 from xedin/execution-caller-mangling
[Mangling] Mangle presence of `@execution(caller)` in a function type
2025-02-20 14:01:26 -08:00
fahadnayyar
9782eae585 Merge pull request #77522 from fahadnayyar/cxx-frt-inheritance-diagnostics
[cxx-interop] Infer SWIFT_SHARED_REFERENCE for types inheriting from a C++ foreign reference type
2025-02-20 13:46:28 -08:00
Allan Shortlidge
f4f9d85503 AST/Sema: Sink SemanticAvailableAttrRequest from Sema into AST.
Unblocks some work on the `@abi` attribute.
2025-02-20 10:29:38 -08:00
Rintaro Ishizaki
8833ff58a2 [AST] Sink the flag collection logic from Parse to AST
* Collect flag in `ParamDecl::setTypeRepr()`.

* [ASTGen] Separate `BridgedParamDecl.setTypeRepr(_:)` from
`BridgedParamDecl.createParsed(_:)` aligning with C++ API. The majority
of the creations don't set the typerepr.

* Update `ParamSpecifierRequest::evaluate` to handle non-implicit
`ParamDecl` without `TypeRepr` (i.e. untyped closure parameter), instead
of `setSpecifier(::Default)` manually in Parse.
2025-02-20 10:04:49 -08:00
Allan Shortlidge
1ff1a8d7bc AST: Store the active DeclContext in AvailabilityScope.
In the future, the `DeclContext` for a given scope will be needed as an input
in order to query for the `AvailabilityDomain` associated with an
`AvailabilitySpec`.
2025-02-20 08:57:45 -08:00
fahadnayyar
d8f919778d [cxx-interop] [cxx-interop] Infer SWIFT_SHARED_REFERENCE for types inheriting from a C++ foreign reference type
rdar://97914474
2025-02-20 08:46:57 -08:00
Pavel Yaskevich
dd1be8f6d4 [Frontend] Hide @execution attribute behind an experimental feature ExecutionAttribute
Since the proposal has not been approved yet we cannot expose
`@execution` attribute.
2025-02-20 00:05:03 -08:00
Rintaro Ishizaki
3a8cb9b094 Merge pull request #79490 from rintaro/astgen-layout-constraint
[ASTGen] Generate generic layout constraint
2025-02-19 22:06:22 -08:00
Pavel Yaskevich
e2ff3308be [Frontend] NFC: Rename NonIsolatedAsyncInheritsIsolationFromContext feature
New name is `AsyncCallerExecution` as stated by the proposal.
2025-02-19 20:00:56 -08:00
Allan Shortlidge
7492e961dc Merge pull request #79494 from tshortli/type-check-availability-spec
Parse/Sema: Move some `AvailabilitySpec` diagnostics from Parse to Sema
2025-02-19 17:07:24 -08:00
Pavel Yaskevich
1067ead82c [Mangling] Mangle presence of @execution(caller) in a function type
If `@execution(caller)` attribute is present on a function type,
mark its presence in the mangling with `YC` suffix.
2025-02-19 16:48:41 -08:00
Rintaro Ishizaki
2b14a233b7 [ASTGen] Generate generic layout constraint 2025-02-19 16:38:00 -08:00
Rintaro Ishizaki
2ceb8f1e57 Merge pull request #79492 from rintaro/astgen-attr-as-modifier
[ASTGen] Add an assertion for attribute as an modifier
2025-02-19 15:56:55 -08:00
Rintaro Ishizaki
6aea6ce2f5 Merge pull request #79469 from rintaro/astgen-custom-type-attr
[ASTGen] Generate CustomAttr on types
2025-02-19 14:06:25 -08:00
Rintaro Ishizaki
e5d5026992 Merge pull request #79456 from rintaro/astgen-paramdecl
[ASTGen] ParamDecl generation improvements
2025-02-19 14:05:55 -08:00
Allan Shortlidge
e90530990a Parse/Sema: Move some AvailabilitySpec diagnostics from Parse to Sema.
Eventually, querying the `AvailabilityDomain` associated with an
`AvailabilitySpec` will require invoking a request that takes a `DeclContext`.
This means that any diagnostics related to the domain identified by an
`AvailabilitySpec` need to be emitted during type-checking rather than parsing.
This change migrates several `AvailabilitySpec` diagnostics from Parse to Sema
to unblock further work.
2025-02-19 11:40:56 -08:00
Rintaro Ishizaki
81475be976 [ASTGen] Add an assertion for attribute as an modifier 2025-02-19 11:09:53 -08:00
Allan Shortlidge
342dc1d36f AST: Fix an unused variable warning in Decl.cpp. 2025-02-18 21:31:48 -08:00
Allan Shortlidge
04024ec222 AST: Simplify printing of AvailabilitySpecs in ASTDumper. 2025-02-18 21:31:48 -08:00
Rintaro Ishizaki
d109a86bb7 [ASTGen] Generate CustomAttr on types
Rework TypeAttribute bridging facilities.
Eliminate the _fake_ `swift::TypeAttributes`, but just use the normal
`BridgedArrayRef` for briding the attribute list. Introduce
`BridgedTypeOrCustomAttr` tagged pointer which resembles
`swift::TypeOrCustomAttr`.
2025-02-18 13:08:50 -08:00
John Hui
bdf22948ce [cxx-interop] Allow Swift to access non-public C++ members (#79093)
This patch introduces an a C++ class annotation, SWIFT_PRIVATE_FILEID,
which will specify where Swift extensions of that class will be allowed
to access its non-public members, e.g.:

    class SWIFT_PRIVATE_FILEID("MyModule/MyFile.swift") Foo { ... };

The goal of this feature is to help C++ developers incrementally migrate
the implementation of their C++ classes to Swift, without breaking
encapsulation and indiscriminately exposing those classes' private and
protected fields.

As an implementation detail of this feature, this patch introduces an
abstraction for file ID strings, FileIDStr, which represent a parsed pair
of module name/file name.

rdar://137764620
2025-02-18 11:22:44 -08:00
Rintaro Ishizaki
6980509f8c [ASTGen] Generate DefaultArgumentInitializer
Rework ParamDecl contextualization.
2025-02-18 11:13:39 -08:00
Alejandro Alonso
e38c3a1dfa Merge pull request #79442 from Azoy/emplace-tt-feature
[AST] Define feature for Builtin.emplace typed throws
2025-02-17 23:12:30 -08:00
Rintaro Ishizaki
cca306a0ca Merge pull request #79440 from rintaro/astgen-tuple-pattern-bridge
[ASTGen] Fix tuple pattern generation
2025-02-17 19:32:03 -08:00
Rintaro Ishizaki
c7e8f58174 Merge pull request #79438 from rintaro/astgen-static-var
[ASTGen] Correctly store static spelling and location to PBD
2025-02-17 15:59:43 -08:00
Rintaro Ishizaki
b1411b3cd8 Merge pull request #79427 from rintaro/astgen-lifetimeattr
[ASTGen] Generate LifetimeAttr
2025-02-17 14:49:38 -08:00
Alejandro Alonso
7480668c7b Add feature for Builtin.emplace typed throws 2025-02-17 12:45:05 -08:00
Gábor Horváth
07b8f0ab32 Merge pull request #79434 from swiftlang/gaborh/escapibility-lookup
[SE-0458] Unify escapability inference for AST and Interop
2025-02-17 20:04:02 +00:00
Rintaro Ishizaki
b7b28b6d8e [ASTGen] Correctly store static spelling and location to PBD 2025-02-17 11:16:53 -08:00
Rintaro Ishizaki
aa646c40ce [ASTGen] Fix tuple pattern generation
Tuple patterns were always empty
2025-02-17 11:01:17 -08:00
Gábor Horváth
bc0da49746 Merge pull request #79432 from swiftlang/gaborh/remove-safe-interop-feature-flag
[cxx-interop] Remove a feature flag
2025-02-17 17:27:03 +00:00
Rintaro Ishizaki
b729746629 [AST] Make LifetimeDescriptor hold Identifier instead of StringRef
No reason to keep the name as a StringRef
2025-02-17 08:59:18 -08:00
Rintaro Ishizaki
94402b6c9d [ASTGen] Generate LifetimeAttr 2025-02-17 08:56:29 -08:00