Commit Graph

721 Commits

Author SHA1 Message Date
Rintaro Ishizaki
a7b427dea6 Feature oldOwnershipOperatorSpellings 2025-03-16 17:38:07 -07:00
Rintaro Ishizaki
a2e40d6c31 [ASTGen] Generate @_typeEraser attribute 2025-03-16 15:18:59 -07:00
Rintaro Ishizaki
6525d6413c [ASTGen] Generate some renamed atrributes 2025-03-16 15:15:15 -07:00
Rintaro Ishizaki
d1f892cbdc [ASTGen] Generate '@reasync' and '@rethrows'
Also, fallback 'shouldBeRejectedByParser' attribute names to
'CustomAttr'.
2025-03-16 15:14:27 -07:00
Rintaro Ishizaki
3d91c33c14 [ASTGen] Handle 'prefixed(_)' in macro introduced names
'_' is not a 'DeclReferenceExprSyntax', but a
'DiscardAssignmentExprSyntax'.
2025-03-16 15:09:07 -07:00
Rintaro Ishizaki
6a7aacd86c [ASTGen] Fix '@differentiable' attribute
* Typo: '_liner' -> '_linear'
* Accept '@differentiable(_linear)' type attribute
2025-03-16 15:05:49 -07:00
Rintaro Ishizaki
d9f5001311 [ASTGen] Fix location of MagicIdentifierLiteralExpr
It should be the location of '#'.
2025-03-16 15:01:40 -07:00
Rintaro Ishizaki
9fc8bba26d [ASTGen] Fix 'RawDocCommentAttr' generation
* Generate only when 'AttachCommentsToDecls' lang option is enabled.
* Fix the range.
2025-03-16 15:00:29 -07:00
Rintaro Ishizaki
c90768f36e [ASTGen] Fix NamedOpaqueReturnTypeRepr
Generic parameter list was missing
2025-03-16 14:59:43 -07:00
Rintaro Ishizaki
c2146af60f [ASTGen] Fix SendingTypeRepr specifier location 2025-03-16 14:50:21 -07:00
Rintaro Ishizaki
925537180b [ASTGen] Handle 'try' at the first element of SequenceExprSyntax
TryExpr must be hosted to wrap the whole sequence expression.
2025-03-16 14:39:01 -07:00
Rintaro Ishizaki
996e72061a [ASTGen] Gnerate PlaceholderTypeRepr 2025-03-16 14:38:32 -07:00
Rintaro Ishizaki
3a4549b991 Merge pull request #79967 from rintaro/astgen-builtin-pound
[ASTGen] Generate miscellaneous builtin pound
2025-03-14 06:17:37 -07:00
Rintaro Ishizaki
ac80775201 [ASTGen] Generate miscellaneous builtin pound
`#error`, `#warning`, and `#assert`.
Also #_hasSymbol statement condition
2025-03-13 20:28:46 -07:00
Doug Gregor
0e873e723c [Isolated conformances] Change syntax to @<global actor type> P
Instead of using the `isolated P` syntax, switch to specifying the
global actor type directly, e.g.,

   class MyClass: @MainActor MyProto { ... }

No functionality change at this point
2025-03-12 23:18:10 -07:00
Michael Gottesman
04bb69f426 Merge pull request #79727 from gottesmm/pr-025c1133954b74e7b4eda77e1a6f3bcafd4eb6cf
[concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
2025-03-10 22:35:00 -07:00
Michael Gottesman
f64dd5a8d5 [concurrency] Add initial support for SwiftSettings to control defaultIsolation at the file level.
We introduce a new macro called #SwiftSettings that can be used in conjunction
with a new stdlib type called SwiftSetting to control the default isolation at
the file level. It overrides the current default isolation whether it is the
current nonisolated state or main actor (when -enable-experimental-feature
UnspecifiedMeansMainActorIsolated is set).
2025-03-10 17:33:45 -07:00
Doug Gregor
a866f5d4ab Merge pull request #79874 from DougGregor/category-footnotes
[Diagnostics] Print category footnotes at the end of translation
2025-03-10 08:45:39 -07: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
Doug Gregor
29b4f3ddbd [Diagnostics] Print category footnotes at the end of translation
When printing diagnostics, category names are printed as [#<category-name>]
at the end of a diagnostic. For all of the category names that are mentioned
in this manner, print "footnotes" at the end of compilation providing
documentation references to each category, e.g.,

    [#deprecated]: <http://example.com/deprecated>
    [#StrictMemorySafety]: <http://example.com/memory-safety>

Right now, these point into the markdown files in the installed toolchain,
same as the URLs behind references. That is subject to change in the future.
2025-03-09 14:36:51 -07:00
Doug Gregor
ab1a64bbfd [ASTGen] Stub out support for method keypaths 2025-03-09 11:42:33 -07:00
Rintaro Ishizaki
5eac58e1e0 [AST] SwitchStmt only hold CaseStmt
Now that there is no way SwitchStmt to hold AST nodes other than
CaseStmt.
2025-03-08 09:14:40 -08:00
Rintaro Ishizaki
b6918a300a Merge pull request #79843 from rintaro/astgen-misc
[ASTGen] Misc fixes
2025-03-07 16:58:44 -08:00
Pavel Yaskevich
fd92e2716a Merge pull request #79812 from xedin/swift-formatter-should-print-child-notes
[DiagnosticBridge] Make sure that diagnostic queues up its child notes
2025-03-07 15:04:47 -08:00
Rintaro Ishizaki
a506bae136 [ASTGen] Generate 'IsExpansionPattern' generic requirements
E.g. `where repeat each T: Comparable`
2025-03-07 10:28:47 -08:00
Rintaro Ishizaki
c8bbfda7eb [ASTGen] Generate '@_functionBuilder' as '@resultBuilder' 2025-03-07 10:28:47 -08:00
Rintaro Ishizaki
664ee9ab21 [ASTGen] Fix 'movesAsLike' in @_rawLayout attribute.
Typo: 'moveAsLike' -> 'movesAsLike'
2025-03-07 10:28:47 -08:00
Rintaro Ishizaki
c669004e4c [ASTGen] Clone expanded AvailabilitySpec to set macro location 2025-03-07 07:18:39 -08:00
Rintaro Ishizaki
ff6cb11bb0 [ASTGen] Introduce 'AvailableAttr::createUnavailableInEmbedded()' 2025-03-07 04:14:50 -08:00
Rintaro Ishizaki
d60f1986a8 [ASTGen] Adopt AvailabilityDomainOrIdentifier scheme
Aligning with libParse
2025-03-07 04:14:50 -08:00
Pavel Yaskevich
a7a9a4d11a [DiagnosticsBridge] Treat empty category name as nil
Default value for `Category` for serialization purposes is
an empty string but it should be handled as `nil` while
bridging because category name cannot be empty when present.
2025-03-06 18:35:02 -08:00
Rintaro Ishizaki
017c0d98ec [ASTGen] Generate AutoDiff attributes
`@differentiable`, `@derivative` and `@transpose`
2025-03-06 10:36:13 -08:00
Doug Gregor
0997a7e016 Merge pull request #79688 from DougGregor/diagnostic-ref-footnotes
[Diagnostics] Reference markdown files for educational notes and diagnostic group documentation
2025-03-05 12:41:16 -08:00
Doug Gregor
398e1ad580 [Diagnostics] Always provide a URL for the category documentation 2025-03-04 09:44:37 -08:00
Artem Chikin
13a8d4b88e [Compile Time Values] Add a new experimental feature and the parsing of the '@const' attribute 2025-03-04 07:30:57 -08:00
Artem Chikin
de26e960e2 Rename '_const' attribute to 'CompileTimeLiteral'
To pave the way for the new experimental feature which will operate on '@const' attribute and expand the scope of what's currently handled by '_const' without breaking compatibility, for now.
2025-03-04 07:30:02 -08:00
Doug Gregor
6f6b8dd071 [Diagnostics] Provide category name + documentation path
Bridge the category name and educational note computed for the Swift
compiler's diagnostics to the newly-introduced category field for
the swift-syntax diagnostics. This lets the swift-syntax renderer
introduce the category name and (optionally) link to the
documentation.
2025-03-03 22:49:33 -08:00
Allan Shortlidge
aaa0e0a7b3 AST/Parse: Parse custom availability domain specs in if #available(...).
Delay resolution of availability domain identifiers parsed in availability
specifications until type-checking. This allows custom domain specifications to
be written in `if #available` queries.
2025-02-27 23:07:55 -08:00
Doug Gregor
ae6ae33201 [SE-0458] Drop "unsafe" effect for for..in loop in inlined code in interfaces
Only compilers can't handle it, so drop it for now.
2025-02-26 22:06:48 -08:00
Doug Gregor
db0d658351 Merge pull request #79645 from DougGregor/enable-se-0458-by-default
[SE-0458] Enable unsafe expressions / attributes / for..in effects by default
2025-02-26 18:51:58 -08:00
Rintaro Ishizaki
bdc953f418 Merge pull request #79629 from rintaro/astgen-rawlayout
[ASTGen] Generate '@_rawLayout' attribute
2025-02-26 15:13:25 -08:00
Doug Gregor
b7b5a2a19d [SE-0458] Enable unsafe expressions / attributes / for..in effects by default
With the acceptance of SE-0458, allow the use of unsafe expressions, the
@safe and @unsafe attributes, and the `unsafe` effect on the for..in loop
in all Swift code.

Introduce the `-strict-memory-safety` flag detailed in the proposal to
enable strict memory safety checking. This enables a new class of
feature, an optional feature (that is *not* upcoming or experimental),
and which can be detected via `hasFeature(StrictMemorySafety)`.
2025-02-26 12:30:07 -08:00
Rintaro Ishizaki
924e1e8bf1 [ASTGen] Generate '@_rawLayout' attribute
Introduce 'generateTypeRepr(expr:)'.
2025-02-26 10:20:51 -08:00
Rintaro Ishizaki
0c2309898f [ASTGen] Rework type specifiers
Handle multiple specifiers. Hanle previously missing 'sending'
specifiers.
2025-02-26 04:39:38 -08:00
Allan Shortlidge
d07e852db1 Merge pull request #79602 from tshortli/availability-spec-storage
AST: Use `AvailabilityDomainOrIdentifier` to store domains in `AvailabilitySpec`
2025-02-25 14:21:23 -08:00
Allan Shortlidge
c54825b4c3 AST: Use AvailabilityDomainOrIdentifier to store domains in AvailabilitySpec. 2025-02-25 09:02:47 -08:00
Doug Gregor
d9ef00ce16 Look for keywords in inactive #if regions when checking for variable uses
Fixes issue #79555
2025-02-24 18:04:31 -08:00
Rintaro Ishizaki
38bafb3872 Merge pull request #79513 from rintaro/astgen-macro-expanded-syntax 2025-02-24 15:06:24 -08:00
Doug Gregor
115abcb637 Merge pull request #79573 from DougGregor/unsafe-for-in-loop
[SE-0458] Implement "unsafe" effect for the for-in loop
2025-02-24 14:49:45 -08:00
Rintaro Ishizaki
20f589c991 Merge pull request #79547 from rintaro/astgen-small-fixes2 2025-02-24 07:25:53 -08:00