Anthony Latsis
06a5670c8f
Basic: Untie swift::SourceLoc from llvm::SMLoc
...
Storing a `llvm::SMLoc` is a superfluous indirection, and getting rid of
it enables us to unconditionally import `SourceLoc` into Swift.
2025-07-11 18:48:42 +01:00
Pavel Yaskevich
43eec8fede
[AST/Sema] SE-0487: Expand @nonexhaustive attribute to support warn argument
...
The spelling `@nonexhaustive(warn)` replaces `@preEnumExtensibility`
attriubte.
2025-07-04 10:20:25 -07:00
Hamish Knight
a3eed77738
[Parse] Fix isEditorPlaceholder checks in the parser
...
Factor out `Token::isEditorPlaceholder` and make sure we're checking
the token's raw text, ensuring we don't ignore backticks.
2025-06-30 21:16:22 +01:00
Hamish Knight
01aa746840
Merge pull request #82568 from hamishknight/mac-n-cheese
2025-06-28 09:16:53 +01:00
Alexis Laferrière
81a0f98783
Merge pull request #82194 from xymus/cdecl-parser
...
Parser: Accept `@cdecl` with an optional identifier for a custom C name
2025-06-27 15:06:11 -07:00
Hamish Knight
8d1c1bfe2d
[IDE] Bail from IDEInspectionSecondPassRequest if parserState is null
...
This shouldn't ever happen, but let's at least make sure we don't
crash.
2025-06-27 18:30:06 +01:00
Andrew Trick
080b68292d
Fix a compiler crash with '@'_lifetime(inout x), add diagnostic
...
This is a common mistake made more common be suggestions of existing diagnostic
that tell users not to use a 'copy' dependency.
Report a diagnostic error rather than crashing the compiler. Fix the diagnostic
output to make sense relative to the source location.
Fixes rdar://154136015 ([nonescapable] compiler assertion with @_lifetime(x: inout x))
2025-06-25 16:34:43 -07:00
Anthony Latsis
3e9923f0c0
ASTBridging: Bridge swift::AccessorKind directly
2025-06-19 04:26:52 +01:00
Slava Pestov
cfa9de8f0a
Parse: Address an llvm_unreachable that is actually reachable
2025-06-17 10:15:30 -04:00
Slava Pestov
908c9368ed
Parse: Only accept certain literals as enum case raw values
...
Just checking for LiteralExpr is too broad, because Sema doesn't
know what to do with RegexLiteralExpr for example.
2025-06-17 09:19:00 -04:00
Alexis Laferrière
2601ff44d4
Parser: Accept @cdecl with an indentifier for the C name
...
Begin accepting the attribute in the form of `@cdecl(cName)`, using an
identifier instead of a string.
For ease of landing this change we still accept the string form. We
should stop accepting it before making this feature available in
production.
2025-06-11 12:42:38 -07:00
Meghana Gupta
dcf072f9d0
Introduce a new suppressible experimental feature to guard @_lifetime
2025-06-07 12:49:07 -07:00
Meghana Gupta
0dfa1fc312
Update spelling for representing lifetime dependencies to @_lifetime
2025-06-07 12:49:07 -07:00
Allan Shortlidge
14341285cb
Parse: Fix unused variable warning.
2025-06-03 09:45:46 -07:00
Pavel Yaskevich
e1e9f04398
Merge pull request #81863 from xedin/using-for-default-isolation-in-file-context
...
[AST/Sema] SE-0478: Implement `using` declaration under an experimental flag
2025-06-02 09:56:29 -07:00
Pavel Yaskevich
21ec5924f7
[AST] NFC: Capitalize UsingSpecifier::nonisolated for consistency
2025-05-31 10:49:50 -07:00
Pavel Yaskevich
ec9132cb5a
[Diagnostics] Tailor using diagnostic to current use-case - default isolation
2025-05-31 10:49:50 -07:00
Pavel Yaskevich
c246a7a372
[AST/Sema] Hide using declaration behind DefaultIsolationPerFile experimental feature
2025-05-31 10:49:50 -07:00
Pavel Yaskevich
4ad27ba61e
[Parse] Implement parsing for using declarations
2025-05-31 10:49:45 -07:00
Slava Pestov
f6f0d75263
Merge pull request #81843 from slavapestov/hamish-fuzzer-fixes
...
Hamish fuzzer fixes
2025-05-31 12:28:56 -04:00
Slava Pestov
6d0c73935b
Parse: An empty escaped identifier is entirely whitespace
2025-05-30 16:27:00 -04:00
Slava Pestov
ff941bc4f3
Sema: Fix crash when any is followed by something that doesn't parse as a type
2025-05-30 14:44:58 -04:00
Hamish Knight
5d1f219acb
Change InlineArray sugar separator x -> of
2025-05-30 13:50:22 +01:00
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
9a3f33de8e
Support trailing commas in types within expressions
2025-05-19 18:56:53 -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
Hamish Knight
3c67271869
[AST] Handle a few more cases in getStartLoc()
...
Handle PatternBindingDecls with missing var locations, which can
happen for loop iterator vars, and FuncDecls with missing name and
func locations, which can happen for `defer`. Also while here make
sure we set the source location of a parser-produced ErrorExpr.
2025-05-14 11:15:42 +01:00
shiz
d12cb84586
[Parse] Avoid parsing unsafe expression before binary or postfix op ( #81429 )
...
rdar://150751248
2025-05-14 10:02:58 +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
Rintaro Ishizaki
533ae2b994
Merge pull request #80928 from kntkymt/kntk-trailing-comma-string-interpolation
...
[Parser] Fix String interpolation accepts invalid argument label syntax without expression
2025-04-22 01:38:50 +09:00
kntkymt
af6b4ad7a1
[Parser] fix parse trailing commna in string interpolation at the end of parseListItem flow instead
2025-04-19 14:36:11 +09: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
Doug Gregor
3380331e7e
[SE-0470] Enable isolated conformances by default
...
The IsolatedConformances feature moves to a normal, supported feature.
Remove all of the experimental-feature flags on test cases and such.
The InferIsolatedConformances feature moves to an upcoming feature for
Swift 7. This should become an adoptable feature, adding "nonisolated"
where needed.
2025-04-13 15:41:53 -07:00
Pavel Yaskevich
f00d8082db
[Parse] Tighten constraints in canParseNonisolatedAsTypeModifier
...
Accept it only if it's spelled `nonisolated(nonsending)` and nothing
else to minimize any possible source compatibility impact.
2025-04-11 15:59:25 -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
Allan Shortlidge
c5e5311cc8
Merge pull request #80560 from tshortli/member-import-visibility-diags-implicit
...
Parse/Sema: Add source locations to implicit code for `MemberImportVisibility` diagnostics
2025-04-05 18:07:55 -07:00
Allan Shortlidge
703126a3ce
Parse: Improve MemberImportVisibility diags for appendLiteral(_:) calls.
...
Ensure compiler generated calls to `appendLiteral(_:)` have source locations for
diagnostics.
Partially resolves rdar://144535697.
2025-04-05 09:48:20 -07:00