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
Hamish Knight
edca7c85ad
Adopt ABORT throughout the compiler
...
Convert a bunch of places where we're dumping to stderr and calling
`abort` over to using `ABORT` such that the message gets printed to
the pretty stack trace. This ensures it gets picked up by
CrashReporter.
2025-05-19 20:55:01 +01:00
Pavel Yaskevich
917524de94
Merge pull request #81496 from xedin/inheritActorContext-alwayse
...
[AST/Sema/SIL] Implement `@_inheritActorContext(always)`
2025-05-15 08:17:30 -07:00
eeckstein
0d3edd629b
Merge pull request #81502 from eeckstein/debug-info-in-embedded
...
embedded: fix source location of diagnostics which appear in imported modules
2025-05-15 06:58:54 +02:00
Pavel Yaskevich
c0aca5384b
[ASTGen] Transform @_inheritActorContext into a custom attribute with an optional modifier
2025-05-14 20:07:59 -07:00
Becca Royal-Gordon
e71f837b1f
[NFC] Stub module selector DeclNameRef/Loc members
2025-05-14 11:16:02 -07:00
Erik Eckstein
5dc71aa0a5
AST/SIL: support source location in diagnostics for de-serialized debug info
...
Diagnostics only work with `SourceLoc` which is basically a pointer into a buffer of the loaded source file.
But when debug info is de-serialized, the SIL `Location` consists of a filename+line+column.
To "convert" this to a `SourceLoc`, the file must be loaded.
This change adds `DiagnosticEngine.getLocationFromExternalSource` for this purpose.
Also, the new protocol `ProvidingSourceLocation` - to which `SourceLoc` and `Location` conform - help to generalize the helper struct `Diagnostic` and make this "conversion" happen automatically.
2025-05-14 11:43:47 +02: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
Alexis Laferrière
02b5998536
Parser: Intro @cdecl attribute and gate it behind feature flag CDecl
2025-04-11 11:34:39 -07: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
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
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
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
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
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
Rintaro Ishizaki
ae5f0f1626
[ASTGen][NFC] Remove unused variable
...
There was a compiler warning `unused variable 'context'`
2025-03-11 13:27:19 -07:00
eeckstein
737b5ec924
Merge pull request #79674 from eeckstein/simplify-open-existential-metatype
...
Optimizer: Rework peephole optimizations to replace existential (archetypes) with concrete types
2025-03-10 08:18:52 +01: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
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
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
c669004e4c
[ASTGen] Clone expanded AvailabilitySpec to set macro location
2025-03-07 07:18:39 -08:00
Rintaro Ishizaki
0a56198879
[ASTGen] Remove BridgedAvailabilityDomain
2025-03-07 07:18:23 -08:00
Erik Eckstein
26c7310a9a
Swift AST: Fix debug description of Type
...
Don't get the swift source version string, but the debug dump string
2025-03-07 15:59:35 +01:00
Erik Eckstein
431401c0dd
Swift AST: add an initializer to SubstitutionMap
...
And let it conform to `NoReflectionChildren` to make it's debug dump in lldb nicer
2025-03-07 15:59:34 +01:00
Erik Eckstein
67925ea27e
Swift AST: add GenericSignature
...
and add `var Type.invocationGenericSignatureOfFunctionType`
2025-03-07 15:59:34 +01: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
Rintaro Ishizaki
017c0d98ec
[ASTGen] Generate AutoDiff attributes
...
`@differentiable`, `@derivative` and `@transpose`
2025-03-06 10:36:13 -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
Allan Shortlidge
b0afd07e14
AST/Parse: Always delay AvailabilityDomain lookup to type-checking.
...
This will unblock parsing and type-checking availability queries that specify
custom availability domains, e.g.:
```
if #available(CustomDomain) {
// Use declarations protected by @available(CustomDomain)
}
```
2025-02-26 21:46:14 -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
Allan Shortlidge
c54825b4c3
AST: Use AvailabilityDomainOrIdentifier to store domains in AvailabilitySpec.
2025-02-25 09:02:47 -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