Jakub Florek
0e6001bc61
Merge pull request #80063 from MAJKFL/swift-lexical-lookup-rfc
...
Refactor `SwiftLexicalLookup` validation to use updated public API interface
2025-03-25 16:19:13 +01:00
Doug Gregor
708300966d
[Diagnostics] Fix recognition of URLs in category file/URL
2025-03-24 10:14:25 -07:00
Kuba Mracek
f402eb623c
[Compile Time Values] Add parsing of @constInitialized attribute under CompileTimeValues experimental feature
2025-03-24 09:31:57 -07:00
Hamish Knight
f8ab391737
Introduce type sugar for InlineArray ( #80087 )
...
* [CS] Decline to handle InlineArray in shrink
Previously we would try the contextual type `(<int>, <element>)`,
which is wrong. Given we want to eliminate shrink, let's just bail.
* [Sema] Sink `ValueMatchVisitor` into `applyUnboundGenericArguments`
Make sure it's called for sugar code paths too. Also let's just always
run it since it should be a pretty cheap check.
* [Sema] Diagnose passing integer to non-integer type parameter
This was previously missed, though would have been diagnosed later
as a requirement failure.
* [Parse] Split up `canParseType`
While here, address the FIXME in `canParseTypeSimpleOrComposition`
and only check to see if we can parse a type-simple, including
`each`, `some`, and `any` for better recovery.
* Introduce type sugar for InlineArray
Parse e.g `[3 x Int]` as type sugar for InlineArray. Gated behind
an experimental feature flag for now.
2025-03-23 15:31:37 -07:00
Holly Borla
be670da373
Merge pull request #79980 from hborla/closure-body-macro
...
[Macros] Implement support for function body macros on closures.
2025-03-21 06:19:36 -07:00
Holly Borla
b005df366a
[Macros] Add an overload of findSyntaxNodeInSourceFile that accepts
...
a predicate.
The new overload is used during macro expansion to find the nearest
syntax node that is either a `DeclSyntax` or a `ClosureExprSyntax`.
This avoids an issue where calling the overload that accepts a
specific type may find an outer, unrelated declaration or closure.
2025-03-20 18:58:47 -07:00
Rintaro Ishizaki
4762985b47
[ASTGen] Add diagnostics stubs for some builting pound syntax
2025-03-20 14:57:41 -07:00
Holly Borla
e2aed1f3d1
[Macros] Remove a print statement from findSyntaxNodeInSourceFile.
...
This code path isn't on an error path, and the print statement causes
unnecessary build output, which also causes test failures.
2025-03-20 11:37:08 -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
Pavel Yaskevich
561071b5d8
Merge pull request #80126 from xedin/refactor-diagnostic-bridge-to-use-bridged-structs
...
[DiagnosticBridge] NFC: Refactor `addQueuedDiagnostic` to use Bridged* types instead of pointers
2025-03-20 00:11:18 -07:00
Holly Borla
ab19ad2b54
[Macros] Look for specific syntax node kinds instead of Syntax when
...
expanding an attached macro.
This fixes a crash in one of the attached macro tests.
2025-03-19 21:45:58 -07:00
Pavel Yaskevich
e456bba910
[DiagnosticBridge] NFC: Switch to use String(bridged:) instead of String(decoding:as:)
2025-03-19 12:04:25 -07:00
Pavel Yaskevich
ac91d39a95
[DiagnosticBridge] NFC: Refactor addQueuedDiagnostic to use BridgedCharSourceRange for diagnostic highlights
2025-03-19 10:18:09 -07:00
Pavel Yaskevich
2ee821164d
[DiagnosticBridge] NFC: Refactor addQueuedDiagnostic to use BridgedStringRef instead of plain pointers
2025-03-19 09:54:36 -07:00
Amritpan Kaur
0af27a6354
[ASTGen] Handle keypath methods.
2025-03-19 08:55:47 -07:00
Holly Borla
31d4f661fc
[Macros] Support function body macros on closures.
2025-03-18 20:50:47 -07:00
Rintaro Ishizaki
202effd1a3
Merge pull request #80046 from rintaro/old-ownership-spellings
...
[ASTGen] map oldOwnershipOperatorSpellings feature flag
2025-03-17 14:55:31 -07:00
Jakub Florek
06c131544c
Switch to using structs from SwiftLexicalLookup results.
...
Switch from `lookIn...` to `lookFor...` naming scheme in `LookupResult`.
2025-03-17 20:51:23 +01:00
Rintaro Ishizaki
54da89e4a7
[ASTGen] Handle 'read' and 'modify' accessors
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
7add493002
[ASTGen] Generate '@_spi_available' attribute
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
d300679aab
[ASTGen] Unique "unimplemented" fatal error message
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
607d122fe9
[ASTGen] Handle several missing syntax
...
* MissingExpr: Generate ErrorExpr with previous token location
* MissingType: Generate ErrorTypeRepr with previous token location
* MissingPattern: Generate implicit '_' pattern for recovery
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
ddd5b12661
[ASTGen] Handle trailing where clause in macro declarations
2025-03-16 17:41:21 -07:00
Rintaro Ishizaki
3cdcab23df
[ASTGen] MacroExpansionExpr at top-level can be decl
2025-03-16 17:41:21 -07:00
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