Commit Graph

754 Commits

Author SHA1 Message Date
Michael Gottesman
6f3d45219a [ast] Represent a parameter's isolation at the SIL level.
I did this by adding flag on SILParamInfo.

rdar://121387872
2024-01-23 15:20:22 -08:00
Pavel Yaskevich
6cdab78028 Merge pull request #70867 from xedin/dynamic-enforcement-of-witness-isolation-with-preconcurrency
[TypeChecker/SILGen] Dynamic enforcement of witness/objc isolation with @preconcurrency attribute
2024-01-17 10:01:37 -08:00
Doug Gregor
255009dddb Implement #isolation macro to produce the isolation of the current context
Introduce a new expression macro that produces an value of type
`(any AnyActor)?` that describes the current actor isolation. This
isolation will be `nil` in non-isolated code, and refer to either the
actor instance of shared global actor in other cases.

This is currently behind the experimental feature flag
OptionalIsolatedParameters.
2024-01-16 14:25:51 -08:00
Pavel Yaskevich
574aee0113 [AST] Allow @preconcurrency attribute in inheritance clause 2024-01-16 10:29:47 -08:00
Ben Barham
a159604f1c Merge pull request #70415 from ahoppen/ahoppen/cache-source-loc-converter
[Macros] Cache `SourceLocationConverter` in `ExportedSourceFile`
2024-01-08 10:49:38 -08:00
Doug Gregor
baaa8f3e5b Merge pull request #70677 from DougGregor/se-0413-typed-throws
Enable SE-0413 "Typed Throws" by default
2024-01-04 16:11:26 -08:00
Doug Gregor
b9c5aca15f Enable SE-0413 "Typed Throws" by default 2024-01-02 15:34:07 -08:00
Michael Gottesman
abba624f6e Add an experimental option TransferringArgsAndResults.
Just splitting off a larger commit to make this easier to review.
2024-01-02 15:03:05 -08:00
Rintaro Ishizaki
409b2760f9 [ASTGen] Statements 2023-12-18 16:09:25 -08:00
Hamish Knight
0a35e00002 [ASTGen] Be defensive over nil firstName
If we only have one name, it should be in
`firstName`, but if it's in `secondName`, handle it
the same, since that's syntactically the same thing.
2023-12-15 21:46:21 +00:00
Hamish Knight
6ebfb60b2c [ASTGen] Diagnose unknown accessor specifiers 2023-12-15 21:46:21 +00:00
Hamish Knight
f9730a7f40 [ASTGen] Generate SubscriptDecls 2023-12-15 21:44:31 +00:00
Hamish Knight
9710a6575d [ASTGen] Better handle ParamDecl arg/param name generation
Move the logic onto the ASTGen side, and plumb
through the flag that will allow subscripts
to have a different argument name defaulting
behavior.
2023-12-15 21:44:30 +00:00
Hamish Knight
29bfdac299 [ASTGen] Generate AccessorDecls 2023-12-15 21:44:30 +00:00
Hamish Knight
28cfe4b7db [ASTGen] Generate type annotations for bindings
Handle the wrapping of TypedPatterns when a type
annotation is specified, and the implicit wrapping
behavior for previously written NamedPatterns.
2023-12-15 21:44:30 +00:00
Hamish Knight
b04d5d5abc [ASTGen] Better handle pattern binding entries
Generate all entries, and ensure we introduce a
PatternBindingInitializer context for non-local
cases. Also use this opportunity to cleanup
`PatternBindingDecl::create`.
2023-12-15 21:44:30 +00:00
Hamish Knight
ab9b3ffa7b [ASTGen] NFC: Run swift-format 2023-12-15 21:44:30 +00:00
Andrew Trick
ace9937e95 Rename NonesapableTypes feature
Follow the feature flag convention for capitalization and be
consistent with the related NoncopyableGenerics feature.

This is a new feature that no wild Swift code has used it yet:

commit e99ce1cc5d
Author: Kavon Farvardin <kfarvardin@apple.com>
Date:   Tue Dec 5 23:25:09 2023

    [NCGenerics] add `~Escapable`

    Basic implementation of `~Escapable` in the type system.
2023-12-14 11:32:03 -08:00
Sophia Poirier
55f9057e61 Merge pull request #70453 from sophiapoirier/unguard-nonisolated-unsafe-feature
[Concurrency] unguard nonisolated(unsafe) attribute from GlobalConcurrency experimental feature
2023-12-14 08:29:21 -08:00
Alex Hoppen
8da07543da [Macros] Cache SourceLocationConverter in ExportedSourceFile
We need a `SourceLocationConverter` every time we create a `PluginMessage.Syntax` to know the source location of that syntax node within the source file. This means that we needed to re-build the line table of the entire source file multiple times for every macro that we expand. Cache it to improve performance.

rdar://119047550
2023-12-14 08:13:48 -08:00
Sophia Poirier
d319404e16 [Concurrency] unguard nonisolated(unsafe) attribute from GlobalConcurrency experimental feature 2023-12-13 15:06:07 -08:00
Rintaro Ishizaki
eb46b6f352 [ASTGen] Implement patterns
Except `MissingPatternSyntax`
2023-12-11 14:00:40 -08:00
Rintaro Ishizaki
847a5671e6 [ASTGen] BridgedXXXTypeRepr_createParsed return the sub type if possible
Just for the consistensy with other BridgedXXX_createParsed().
2023-12-08 15:07:58 -08:00
Rintaro Ishizaki
8f70dc3535 [ASTGen] Implement PackElementTypeRepr, InverseTypeRepr and class constraint 2023-12-08 12:15:16 -08:00
Rintaro Ishizaki
5e271ec4ee [ASTGen] Implement PackElement and PackExpansion expressions 2023-12-08 12:15:05 -08:00
Rintaro Ishizaki
0084a8a834 [ASTGen] Implement unary expressions
AwaitExpr, BorrowExpr, ConsumeExpr, CopyExpr, TryExpr, ForceTryExpr,
and OptionalTryExpr.
2023-12-08 12:15:05 -08:00
Rintaro Ishizaki
471cba2eca [ASTGen] Implement dictionary literal expression generation 2023-12-08 12:15:04 -08:00
Rintaro Ishizaki
8b026f2334 [ASTGen] Implement DotSelfExpr generation 2023-12-08 12:12:16 -08:00
Rintaro Ishizaki
a12113a490 [ASTGen] TokenSyntax.keyworkKind to directly get Keyword kind
This should be faster than e.g. `token.tokenKind == .keyword(.true)`.
2023-12-07 00:23:51 -08:00
Meghana Gupta
9a4bb7337a Merge pull request #70263 from meg-gupta/resultdependson
Add support for _resultDependsOn
2023-12-06 22:12:23 -08:00
Alex Hoppen
222739a71d Merge pull request #70255 from ahoppen/ahoppen/rename-refactoring
[Rename] Collection of improvements to make syntactic rename easier to read
2023-12-06 19:46:01 -08:00
Meghana Gupta
b6326f5f24 Add initial support for _resultDependsOn
These attributes are used to establish lifetime dependence between
argument and the result.

Add them under NonEscapableTypes experimental feature
2023-12-06 16:38:38 -08:00
Alex Hoppen
5cae50a1a6 [SourceKit] Refactor addSyntacticRenameRanges
Refactor `addSyntacticRenameRanges`, adding comments to make it easier to follow and remove its dependency on the `IsFunctionLike` parameter in `RenameLoc`.
2023-12-06 14:31:47 -08:00
Rintaro Ishizaki
813f1d8fa8 [ASTGen] Small cleanups
* Remove 'public' from the functions, those werr remnants of when
  ASTGenVisitor conformed to SyntaxTransformVisitor.
* Remove an unreachable `default:` from a switch.
* Remove unused `UnsafePointer.raw`.
2023-12-05 19:29:50 -08:00
Rintaro Ishizaki
2f46e6f311 [ASTGen] Add back TokenSyntax.bridgedIdentifier(in:) etc.
To avoid conflicts while migration. When all usage are migrated, this
commit should be reverted.
2023-12-05 14:32:14 -08:00
Rintaro Ishizaki
7ab4003a96 [ASTGen] Move getIdentifier() etc to ASTGenVisitor
Now that `getIdentifier()` has some logic in it. It's not a simple
bridging.
2023-12-05 14:32:09 -08:00
Rintaro Ishizaki
71ecdfca3f [ASTGen] Move getIdentifier logic to ASTGen side
Ideally ASTBriding should only do the neccessary work for briding. All
non-trivial logic should be in ASTGen.
2023-12-05 14:26:31 -08:00
Rintaro Ishizaki
e1f0089873 [ASTGen] Start using 'TokenSyntax.rawText'
`TokenSyntax.text` causes intiation of heap allocated `Swift.String` for
each access. `TokenSyntax.rawText` is faster than that because it's just
a reference to the pre-allocated buffer. Also, converting to
`BridgedString` is simplar, and guaranteed to be free, unlike bridging
via `String.withUTF8(_:)`
2023-12-04 14:00:39 -08:00
Rintaro Ishizaki
a7a0b329f2 Merge pull request #70168 from rintaro/astgen-sequenceexpr
[ASTGen] Implement SequenceExpr generation
2023-12-04 11:31:36 -08:00
Hamish Knight
e6ec9b0c8b Merge pull request #70172 from hamishknight/or-else 2023-12-04 17:33:57 +00:00
Rintaro Ishizaki
0c111ace0a [ASTGen] Implement SequenceExpr generation 2023-12-04 06:50:31 -08:00
Hamish Knight
f4e09c5531 [AST] Tighten up invariants around IfStmt
The 'then' statement must be a BraceStmt, and
the 'else' must either be a BraceStmt or an IfStmt.
2023-12-04 11:09:01 +00:00
Rintaro Ishizaki
d592ae4d9c [ASTGen] Generalize BridgedNullable
Declare `BridgedNullable` protocol for `ExpressibleByNilLiteral`.
Simplify `HasNullable` implementation using `BridgedNullable`, and
rename it to `BridgedHasNullable`.
2023-12-03 22:52:46 -08:00
Doug Gregor
c7c2f054c8 Merge pull request #70169 from DougGregor/throws-clause
Adjust for throws-clause refactoring in swift-syntax
2023-12-02 07:32:21 -08:00
Doug Gregor
5aa29c0b1d Adjust for throws-clause refactoring in swift-syntax 2023-12-01 12:47:46 -08:00
Rintaro Ishizaki
c46eb58ed8 Merge pull request #70138 from rintaro/astgen-compoundname
[ASTGen] Generate compound name expression
2023-12-01 11:31:38 -08:00
Rintaro Ishizaki
4796ea458a [ASTGen] Generate compound name expression
Bridge DeclBaseName, DeclNameRef, and DeclNameLoc.
Implement UnresolvedMemberExpr generation.
2023-11-30 14:42:02 -08:00
Alex Hoppen
cc858ab253 Merge pull request #70008 from ahoppen/ahoppen/name-matcher-in-swift
Share implementation of local rename and related identifiers + implement `NameMatcher` in Swift
2023-11-30 09:37:53 -08:00
Alex Hoppen
bc5cc43a06 Don’t include <vector> in IDEBridging.h 2023-11-28 14:04:37 -08:00
Alex Hoppen
14bc8148fe Don’t include vector in `BasicBridging.h 2023-11-28 14:03:31 -08:00