Commit Graph

2438 Commits

Author SHA1 Message Date
Arnold Schwaighofer
7ac551636b Merge pull request #81714 from aschwaighofer/se0460
SE-0460: Introduce @specialized attribute
2025-05-28 12:03:48 -07:00
Arnold Schwaighofer
13ff5abdb8 Introduce @specialized attribute
Implements SE-0460 -- the non-underscored version of @specialized.

It allows to specify "internal" (not abi affecting) specializations.

rdar://150033316
2025-05-23 13:12:47 -07:00
Rintaro Ishizaki
6f24696878 Merge pull request #81612 from calda/cal--trailing-comma-missing-from-6.1
Add trailing comma support in cases missing from Swift 6.1
2025-05-22 11:30:28 -07:00
Cal Stephens
9072d860d9 Revert changes to trailing commas in attributes like @available 2025-05-19 16:00:42 -07:00
Cal Stephens
1a3d71cc53 Add trailing comma support in cases missing from Swift 6.1 2025-05-19 09:19:49 -07:00
Pavel Yaskevich
04d46760bb [AST] Extend @_inheritActorContext attribute to support optional always modifier
By default (currently) the closure passed to a parameter with `@_inheritActorContext`
would only inherit isolation from `nonisolated`, global actor isolated or actor
context when "self" is captured by the closure. `always` changes this behavior to
always inherit actor isolation from context regardless of whether it's captured
or not.
2025-05-14 20:07:57 -07:00
Hamish Knight
e0ceb85c6a [AST] Remove unparsed case from FuncDecl::getSourceRange
This wasn't really sound since it could result in source ranges that
have different buffers for the start and end loc. Instead, adjust
the parser logic to look at the brace range.
2025-05-14 11:15:42 +01:00
Rintaro Ishizaki
682d2634ba [Parse] Parse operator function with value generics
Operator function parsing has a heuristics to determine if `<` a part of
the operator name or the generic parameter clause. Handle `let` there
because value generics uses it.

rdar://149556573
2025-05-02 17:09:13 -07:00
Becca Royal-Gordon
25bf069ce3 [Legacy parser] No freestanding macros in @abi
SwiftSyntaxParser is already doing this, and we already diagnosed it in Sema anyway, so we’re just moving that diagnostic earlier so the ASTGen testing mode is happy. Also adding compiler tests for it.

Macro-related tests are not included in this commit; they require matching swift-syntax changes which are being negotiated.
2025-04-18 14:50:01 -07:00
Alexis Laferrière
a6beaf8deb Merge branch 'main' into cdecl-global-function-checking 2025-04-16 11:19:37 -07:00
Pavel Yaskevich
07ff063ae3 [AST/ASTGen/Sema/Serialization] Remove @execution attribute
Complete the transition from `@execution` to `@concurrent` and `nonisolated(nonsending)`
2025-04-11 15:59:25 -07:00
Pavel Yaskevich
54b62ae983 [AST/Parse] Implement nonisolated(nonsending) type modifier 2025-04-11 15:59:25 -07:00
Pavel Yaskevich
b1ffa063b6 [AST/Sema] Intoduce nonisolated(nonsending) as a replacement for @execution(caller) 2025-04-11 15:57:11 -07:00
Pavel Yaskevich
4b8c8e7d72 [AST/Sema] Replace @execution(concurrent) with @concurrent 2025-04-11 12:08:29 -07:00
Pavel Yaskevich
e3cbdaa863 [Parse] Remove warning about @concurrent being alternative to @Sendable 2025-04-11 12:08:29 -07:00
Alexis Laferrière
02b5998536 Parser: Intro @cdecl attribute and gate it behind feature flag CDecl 2025-04-11 11:34:39 -07:00
Michael Gottesman
77a86a525b Merge pull request #79891 from gottesmm/pr-9df6772bb44656cbd85cad72ee5c3637caab8956
Make Feature a struct enum so we can put methods on it.
2025-04-07 10:32:23 -07:00
Meghana Gupta
2d9217bb4f Merge pull request #80541 from meg-gupta/inoutreland
Reland #80452
2025-04-07 10:20:10 -07:00
Anthony Latsis
3c3dd54f39 AST: Cut down on DescriptiveDeclKind usage in DiagnosticsParse.def 2025-04-05 12:31:20 +01:00
Michael Gottesman
3ff9463957 Make Feature a struct enum so we can put methods on it.
Just noticed this as I was looking at making other changes.
2025-04-05 10:08:29 +01:00
Meghana Gupta
ef1e94577f Revert "Merge pull request #80540 from swiftlang/revert-80452-lifetimeinout"
This reverts commit 6eaa07a880, reversing
changes made to e75ee3f4cf.
2025-04-04 09:50:13 -07:00
Artem Chikin
39e1791b67 Revert "Add support for inout lifetime dependence" 2025-04-04 09:00:09 -07:00
Meghana Gupta
d87a2b2ada Rename ParsedLifetimeDependenceKind::Scope -> ParsedLifetimeDependenceKind::Borrow 2025-04-03 17:22:13 -07:00
Meghana Gupta
cfacd25df4 Add support for @lifetime(&arg) 2025-04-03 17:22:06 -07:00
Anthony Latsis
99f63ed933 DiagnosticEngine: Support TypeAttribute diagnostic arguments 2025-04-03 01:52:38 +01:00
Anthony Latsis
fffa8c2f51 Diag: Abstract away some calls to DeclAttribute::getAttrName 2025-03-28 02:01:27 +00:00
Hamish Knight
42e554ef7d [Parse] Set AttrRange for @nonisolated
Make sure we set the `AttrRange` in cases where `@` is present, but
`unsafe` isn't present.

rdar://147965036
2025-03-27 18:48:55 +00:00
Becca Royal-Gordon
d2276362a4 Support @abi on subscripts
And make sure we reject it on `deinit`s and accessors.
2025-03-26 10:47:57 -07:00
Becca Royal-Gordon
b4d545f873 [NFC] Fix AllowFeatureSuppressionAttr atLoc 2025-03-26 10:47:12 -07:00
Nate Chandler
317a379693 [DefaultOverrides] SIL printing/parsing. 2025-03-25 07:22:14 -07:00
Rintaro Ishizaki
92a6fece48 [ASTGen] ObjC improvements
* Generate `#selector(...)` expression
* Generate `#keyPath(...)` expression
* Implicit `@objc` attribute for `@_objcImplementation` attribute
2025-03-20 05:04:58 -07:00
Joe Groff
24a91bba5d Merge pull request #80038 from jckarter/addressable-for-deps-lowering
SIL: Lower fields that are conditionally addressable because of a dependency.
2025-03-17 21:28:33 -07:00
Alex Hoppen
829e03c104 Merge pull request #79974 from a7medev/feature/complete-single-option-decl-attrs 2025-03-17 15:40:00 -07:00
Joe Groff
c949e6295f SIL: Lower fields that are conditionally addressable because of a dependency.
Parameters of generic type need to be treated as potentially
addressable-for-dependencies, but we don't want callers using the generic
function with concrete types that are known not to be addressable-for-
dependencies to be overconstrained. In SILFunctionType lowering, lower
these dependencies distinctly as conditionally addressable, meaning that
the dependency on an argument depends on whether the concrete type of
that argument is (potentially) addressable-for-dependencies or not.
2025-03-15 16:07:03 -07:00
Ahmed Mahmoud
78990ffe3f [IDE] Pass ParameterizedDeclAttributeKind to parseSingleAttrOption rather than completion callback 2025-03-14 13:19:53 +02:00
Ahmed Mahmoud
a340dca4b5 [IDE] Add parameter label comment for HasLabel 2025-03-14 04:48:22 +02:00
Ahmed Mahmoud
704e9fcc35 [IDE] Fix access control set completion as a declaration item 2025-03-14 04:45:07 +02:00
Ahmed Mahmoud
3bb2da0d0d [IDE] Remove unnecessary code complete checks 2025-03-14 04:44:26 +02:00
Ahmed Mahmoud
ab6ad401b3 [IDE] Consume identifier and ')' after parenthesized modifier
This fixes an issue where valid parenthesized modifiers like nonisolated(unsafe) get misinterpreted as function calls.
2025-03-14 02:34:04 +02:00
Ahmed Mahmoud
9767cc1158 [IDE] Remove duplicate code & add parameter label 2025-03-13 21:45:40 +02:00
Ahmed Mahmoud
c871e4962f [IDE] Recover from incomplete unowned and nonisolated in isStartOfSwiftDecl 2025-03-13 02:19:18 +02:00
Ahmed Mahmoud
951988c100 [IDE] Return Code Completion Status in Access Control Completion 2025-03-13 02:19:18 +02:00
Ahmed Mahmoud
78b4e851a7 [IDE] Complete unowned, nonisolated, access-control parameter 2025-03-13 02:19:18 +02:00
Ahmed Mahmoud
673d6a1d9f [IDE] Rename CustomSyntaxAttributeKind to ParameterizedDeclAttributeKind 2025-03-13 02:19:17 +02:00
Becca Royal-Gordon
7c867ca1da [NFC] Split DeclAttrOptions into two types
We’re running out of bits in DeclAttrOptions, so split it in two: DeclAttrRequirements contains all the `On*` options that describe the declarations allowed to have the attribute, while the other options are now DeclAttrBehaviors.

This commit also sorts the entries in DeclAttr.def by serialization code and improves the formatting of the file.
2025-03-12 14:14:16 -07:00
Gabor Horvath
22e2276c4f [cxx-interop] Do not require the LifetimeDependence feature in _SwiftifyImport
We use experimental features to let people know that the construct is
subject to change and users should not rely on this unless they are
willing to rewrite the uses of this feature later. However, in compiler
generated code everything should be fair game, we will update the
compiler when these features change. This is a requirement to be able to
turn safe wrapper generation on by default.
2025-03-11 17:38:53 +00:00
Rintaro Ishizaki
accd108e4a Merge pull request #79857 from rintaro/retire-pound-diagnostics-decl
[Parse/AST] Remove PoundDiagnosticDecl
2025-03-09 21:23:16 -07:00
Rintaro Ishizaki
002d7d7cdf [Parse/AST] Remove PoundDiagnosticDecl
There is no reson to make a AST node for '#error' and '#warning'
directives. Parser knows the diagnostics should be emitted or not.
2025-03-07 21:48:01 -08:00
Rintaro Ishizaki
ff6cb11bb0 [ASTGen] Introduce 'AvailableAttr::createUnavailableInEmbedded()' 2025-03-07 04:14:50 -08:00
Allan Shortlidge
b64df7384e AST: Simplify AvailabilityRange construction.
Introduce a constructor that takes an `llvm::VersionTuple` directly, instead of
needing to spell out `VersionRange::allGTE(<tuple>)` which is unnecessarily
verbose.
2025-03-04 19:41:04 -08:00