Becca Royal-Gordon
3baba0b262
Type check @abi decls (sans attrs)
...
This commit compares the decl inside the `@abi` attribute to the decl it’s attached to, diagnosing ABI-incompatible differences. It does not yet cover attributes, which are a large undertaking.
2025-03-26 10:47:13 -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
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
Andrew Trick
64a48d08e1
Update tests for strict @lifetime type checking
2025-03-19 11:59:04 -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
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
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
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
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
c90768f36e
[ASTGen] Fix NamedOpaqueReturnTypeRepr
...
Generic parameter list was missing
2025-03-16 14:59:43 -07:00
Rintaro Ishizaki
bc668b6232
[ASTGen] Fix nullability
...
For 'arbitrary' macro names
2025-03-16 14:48:00 -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
ac80775201
[ASTGen] Generate miscellaneous builtin pound
...
`#error`, `#warning`, and `#assert`.
Also #_hasSymbol statement condition
2025-03-13 20:28:46 -07:00
Alejandro Alonso
d0513a7aec
Merge pull request #79665 from Azoy/value-generics-no-more-experiment
...
[AST] Make ValueGenerics feature always available
2025-03-10 15:14:34 -07: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
664ee9ab21
[ASTGen] Fix 'movesAsLike' in @_rawLayout attribute.
...
Typo: 'moveAsLike' -> 'movesAsLike'
2025-03-07 10:28:47 -08:00
Rintaro Ishizaki
017c0d98ec
[ASTGen] Generate AutoDiff attributes
...
`@differentiable`, `@derivative` and `@transpose`
2025-03-06 10:36:13 -08:00
Alejandro Alonso
c1bb143648
Make ValueGenerics feature always available
2025-02-27 10:03:37 -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
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
Rintaro Ishizaki
38bafb3872
Merge pull request #79513 from rintaro/astgen-macro-expanded-syntax
2025-02-24 15:06:24 -08:00
Rintaro Ishizaki
20f589c991
Merge pull request #79547 from rintaro/astgen-small-fixes2
2025-02-24 07:25:53 -08:00
Rintaro Ishizaki
2bf69742d1
[ASTGen] Fix ReferenceOwnershipAttr modifier
...
Similar to 7dd8944 . Modifier argument is not parsed as a keyword.
2025-02-21 18:38: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
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
c460947a73
[ASTGen] Wrap optional binding pattern with type annotation
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
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
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
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
Rintaro Ishizaki
2b14a233b7
[ASTGen] Generate generic layout constraint
2025-02-19 16:38:00 -08:00
Rintaro Ishizaki
1a5228b31e
Merge pull request #79468 from rintaro/astgen-nonisolated
...
[ASTGen] Generate "nonisolated" decl modifier
2025-02-19 15:46:32 -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
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
Rintaro Ishizaki
2d9da4dc7a
[ASTGen] Generate "nonisolated" decl modifier
2025-02-18 12:35:20 -08:00
Rintaro Ishizaki
43eeb14ba0
[ASTGen] Generate attributes on ParamDecls
2025-02-18 11:14:13 -08:00
Rintaro Ishizaki
6980509f8c
[ASTGen] Generate DefaultArgumentInitializer
...
Rework ParamDecl contextualization.
2025-02-18 11:13:39 -08:00
Rintaro Ishizaki
31efebe896
Merge pull request #79454 from rintaro/astgen-setteraccess
...
[ASTGen] Fix SetterAccessAttr e.g. private(set)
2025-02-18 07:09:57 -08:00
Rintaro Ishizaki
015dc8a7ae
Merge pull request #79453 from rintaro/astgen-minus-number
...
[ASTGen] Generate "minus" number literal expression
2025-02-18 07:09:45 -08:00
Rintaro Ishizaki
7dd8944512
[ASTGen] Fix SetterAccessAttr e.g. private(set)
...
'set' part was not parsed as a keyword. Let's just compare the text.
2025-02-17 22:15:17 -08:00
Rintaro Ishizaki
f172725c36
[ASTGen] Handle reasync and rethrows
...
Introduce generate(functionSignature:for:)
2025-02-17 22:06:29 -08:00