Skip to content

Merge main into release/6.2 #3102

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
785547e
Make `@abi` non-experimental
beccadax Apr 25, 2025
c2eabd2
Merge pull request #3065 from beccadax/abi-let-you-graduate
bnbarham May 8, 2025
b9d90d9
[CI] Remove skip for ready for review
bnbarham May 9, 2025
d95175a
Update the allowed user for publishing releases to bnbarham
bnbarham May 9, 2025
f6bfa95
Merge pull request #3076 from bnbarham/update-publisher
bnbarham May 12, 2025
eda5e2f
Merge pull request #3075 from bnbarham/run-ci-on-ready
bnbarham May 12, 2025
cc3a7a2
Add more code owners
bnbarham May 14, 2025
18628b2
Merge pull request #3078 from bnbarham/update-codeowners
bnbarham May 15, 2025
462f819
Add trailing comma support in cases missing from Swift 6.1
calda May 19, 2025
793ccbd
Revert attribute changes
calda May 19, 2025
f784853
Support trailing commas in types within expressions
calda May 20, 2025
29fd4cc
Merge pull request #3080 from calda/cal--trailing-comma-missing-from-6.1
rintaro May 22, 2025
d754c2d
Add support for SE-0460 @specialized
aschwaighofer May 20, 2025
0efe931
Add a `SendableMetatype` conformance to `Macro`
bnbarham May 24, 2025
e95026e
Merge pull request #3084 from bnbarham/add-sendable-metatype
bnbarham May 27, 2025
5546cfd
Merge pull request #3082 from aschwaighofer/se0460
aschwaighofer May 28, 2025
07fff59
Change InlineArray sugar separator `x` -> `of`
hamishknight May 30, 2025
8d2c20f
Merge pull request #3088 from hamishknight/x-of-hearts
hamishknight May 31, 2025
95bebf6
[SwiftParser] SE-0478: Implement `using` declaration under an experim…
xedin May 30, 2025
6de157b
Merge pull request #3087 from xedin/using-decl
xedin Jun 2, 2025
93f2408
Handle macro expansion args in placeholder expansion
hamishknight Jun 4, 2025
98f6feb
Merge pull request #3092 from hamishknight/place-mac
hamishknight Jun 5, 2025
9a3c962
Relax precondition in `postProcessMultilineStringLiteral`
ahoppen Jun 10, 2025
3274aaa
Merge pull request #3098 from ahoppen/string-literal-precondition
hamishknight Jun 11, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/CODEOWNERS
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
# Order is important. The last matching pattern has the most precedence.

# Owner of anything in SwiftSyntax not owned by anyone else.
* @ahoppen @bnbarham
* @ahoppen @bnbarham @hamishknight @rintaro

# Macros
/Sources/SwiftSyntaxMacros @DougGregor
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/publish_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
runs-on: ubuntu-latest
steps:
- run: |
if [[ "${{ github.triggering_actor }}" != "ahoppen" ]]; then
if [[ "${{ github.triggering_actor }}" != "bnbarham" ]]; then
echo "${{ github.triggering_actor }} is not allowed to create a release"
exit 1
fi
Expand Down
9 changes: 2 additions & 7 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
name: Pull request

# PRs created by GitHub Actions don't kick off further actions (https://github.com/peter-evans/create-pull-request/blob/d57e551ebc1a16dee0b8c9ea6d24dba7627a6e35/docs/concepts-guidelines.md#triggering-further-workflow-runs).
# As a workaround, we mark automerge PRs that are created by GitHub actions as draft and trigger the GitHub actions by marking the PR as ready for review. We'd prefer not re-triggering testing on a normal user's PR in this case, but skipping them causes the checks to reset.
on:
pull_request:
types: [opened, reopened, synchronize, ready_for_review]
Expand All @@ -11,20 +13,15 @@ concurrency:
jobs:
tests:
name: Test
# PRs created by GitHub Actions don't kick off further actions (https://github.com/peter-evans/create-pull-request/blob/d57e551ebc1a16dee0b8c9ea6d24dba7627a6e35/docs/concepts-guidelines.md#triggering-further-workflow-runs).
# As a workaround, we mark automerge PRs that are created by GitHub actions as draft and trigger the GitHub actions by marking the PR as ready for review. But we don't want to re-trigger testing this when a normal user's PR is marked as ready for review.
if: (github.event.action != 'ready_for_review') || (github.event.action == 'ready_for_review' && github.event.pull_request.user.login == 'github-actions[bot]')
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
soundness:
name: Soundness
if: (github.event.action != 'ready_for_review') || (github.event.action == 'ready_for_review' && github.event.pull_request.user.login == 'github-actions[bot]')
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
with:
api_breakage_check_enabled: false # https://github.com/swiftlang/swift-syntax/issues/3010
docs_check_additional_arguments: "--disable-parameters-and-returns-validation"
verify_source_code:
name: Validate generated code
if: (github.event.action != 'ready_for_review') || (github.event.action == 'ready_for_review' && github.event.pull_request.user.login == 'github-actions[bot]')
runs-on: ubuntu-latest
container:
image: swift:latest
Expand All @@ -37,7 +34,6 @@ jobs:
run: "./swift-syntax-dev-utils verify-source-code --toolchain /usr"
test_using_swift_syntax_dev_utils_linux:
name: Run tests using swift-syntax-dev-utils (Linux)
if: (github.event.action != 'ready_for_review') || (github.event.action == 'ready_for_review' && github.event.pull_request.user.login == 'github-actions[bot]')
runs-on: ubuntu-latest
container:
image: swift:latest
Expand All @@ -50,7 +46,6 @@ jobs:
run: "./swift-syntax-dev-utils test --enable-rawsyntax-validation --enable-test-fuzzing --toolchain /usr"
test_using_swift_syntax_dev_utils_windows:
name: Run tests using swift-syntax-dev-utils (Windows)
if: (github.event.action != 'ready_for_review') || (github.event.action == 'ready_for_review' && github.event.pull_request.user.login == 'github-actions[bot]')
runs-on: windows-2022
steps:
- name: Pull Docker image
Expand Down
22 changes: 19 additions & 3 deletions CodeGeneration/Sources/SyntaxSupport/AttributeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,11 @@ public let ATTRIBUTE_NODES: [Node] = [
// Special arguments for keyword decl name e.g. 'subscript(_:)', and availability arguments.
kind: .node(kind: .specializeAttributeArgumentList)
),
Child(
name: "specializedArguments",
// Special arguments for generic where clause.
kind: .node(kind: .specializedAttributeArgument)
),
Child(
name: "objCName",
// Special arguments for Objective-C names. e.g. 'methodNameWithArg1:Arg2:'
Expand Down Expand Up @@ -122,8 +127,7 @@ public let ATTRIBUTE_NODES: [Node] = [
Child(
name: "abiArguments",
// Special arguments for declaration syntax. e.g. @abi(func abiName() -> Int)
kind: .node(kind: .abiAttributeArguments),
experimentalFeature: .abiAttribute
kind: .node(kind: .abiAttributeArguments)
),
]),
documentation: """
Expand Down Expand Up @@ -256,7 +260,6 @@ public let ATTRIBUTE_NODES: [Node] = [
Node(
kind: .abiAttributeArguments,
base: .syntax,
experimentalFeature: .abiAttribute,
nameForDiagnostics: "ABI-providing declaration",
documentation: "The arguments of the '@abi' attribute",
children: [
Expand Down Expand Up @@ -719,6 +722,19 @@ public let ATTRIBUTE_NODES: [Node] = [
]
),

Node(
kind: .specializedAttributeArgument,
base: .syntax,
nameForDiagnostics: "argument to '@specialized",
documentation: "The generic where clause for the `@specialized` attribute",
children: [
Child(
name: "genericWhereClause",
kind: .node(kind: .genericWhereClause)
)
]
),

Node(
kind: .specializeTargetFunctionArgument,
base: .syntax,
Expand Down
31 changes: 31 additions & 0 deletions CodeGeneration/Sources/SyntaxSupport/DeclNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,37 @@ public let DECL_NODES: [Node] = [
]
),

Node(
kind: .usingDecl,
base: .decl,
experimentalFeature: .defaultIsolationPerFile,
nameForDiagnostics: "using",
documentation: """
A `using` declaration, currently used to control actor isolation within the current file.

An example of a `using` declaration is

```swift
using @MainActor
```
""",
children: [
Child(
name: "usingKeyword",
kind: .token(choices: [.keyword(.using)]),
documentation: "The `using` keyword for this declaration."
),
Child(
name: "specifier",
kind: .nodeChoices(choices: [
Child(name: "attribute", kind: .node(kind: .attribute)),
Child(name: "modifier", kind: .token(choices: [.token(.identifier)])),
]),
documentation: "The specifier that could be either an attribute or a modifier."
),
]
),

Node(
kind: .inheritedTypeList,
base: .syntaxCollection,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ public enum ExperimentalFeature: String, CaseIterable {
case nonescapableTypes
case trailingComma
case coroutineAccessors
case abiAttribute
case keypathWithMethodMembers
case oldOwnershipOperatorSpellings
case inlineArrayTypeSugar
case defaultIsolationPerFile

/// The name of the feature as it is written in the compiler's `Features.def` file.
public var featureName: String {
Expand All @@ -39,14 +39,14 @@ public enum ExperimentalFeature: String, CaseIterable {
return "TrailingComma"
case .coroutineAccessors:
return "CoroutineAccessors"
case .abiAttribute:
return "ABIAttribute"
case .keypathWithMethodMembers:
return "KeypathWithMethodMembers"
case .oldOwnershipOperatorSpellings:
return "OldOwnershipOperatorSpellings"
case .inlineArrayTypeSugar:
return "InlineArrayTypeSugar"
case .defaultIsolationPerFile:
return "DefaultIsolationPerFile"
}
}

Expand All @@ -65,14 +65,14 @@ public enum ExperimentalFeature: String, CaseIterable {
return "trailing commas"
case .coroutineAccessors:
return "coroutine accessors"
case .abiAttribute:
return "@abi attribute"
case .keypathWithMethodMembers:
return "keypaths with method members"
case .oldOwnershipOperatorSpellings:
return "`_move` and `_borrow` as ownership operators"
case .inlineArrayTypeSugar:
return "sugar type for InlineArray"
case .defaultIsolationPerFile:
return "set default actor isolation for a file"
}
}

Expand Down
11 changes: 7 additions & 4 deletions CodeGeneration/Sources/SyntaxSupport/KeywordSpec.swift
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ public enum Keyword: CaseIterable {
case _PackageDescription
case _read
case _RefCountedObject
case specialized
case _specialize
case _spi_available
case _Trivial
Expand Down Expand Up @@ -268,14 +269,14 @@ public enum Keyword: CaseIterable {
case unsafe
case unsafeAddress
case unsafeMutableAddress
case using
case `var`
case visibility
case weak
case `where`
case `while`
case willSet
case wrt
case x
case yield

public var spec: KeywordSpec {
Expand Down Expand Up @@ -340,6 +341,8 @@ public enum Keyword: CaseIterable {
return KeywordSpec("_read")
case ._RefCountedObject:
return KeywordSpec("_RefCountedObject")
case .specialized:
return KeywordSpec("specialized")
case ._specialize:
return KeywordSpec("_specialize")
case ._spi_available:
Expand All @@ -357,7 +360,7 @@ public enum Keyword: CaseIterable {
case ._version:
return KeywordSpec("_version")
case .abi:
return KeywordSpec("abi", experimentalFeature: .abiAttribute)
return KeywordSpec("abi")
case .accesses:
return KeywordSpec("accesses")
case .actor:
Expand Down Expand Up @@ -668,6 +671,8 @@ public enum Keyword: CaseIterable {
return KeywordSpec("unsafeAddress")
case .unsafeMutableAddress:
return KeywordSpec("unsafeMutableAddress")
case .using:
return KeywordSpec("using")
case .var:
return KeywordSpec("var", isLexerClassified: true)
case .visibility:
Expand All @@ -682,8 +687,6 @@ public enum Keyword: CaseIterable {
return KeywordSpec("willSet")
case .wrt:
return KeywordSpec("wrt")
case .x:
return KeywordSpec("x", experimentalFeature: .inlineArrayTypeSugar)
case .yield:
return KeywordSpec("yield")
}
Expand Down
3 changes: 3 additions & 0 deletions CodeGeneration/Sources/SyntaxSupport/SyntaxNodeKind.swift
Original file line number Diff line number Diff line change
Expand Up @@ -259,6 +259,7 @@ public enum SyntaxNodeKind: String, CaseIterable, IdentifierConvertible, TypeCon
case simpleStringLiteralSegmentList
case someOrAnyType
case sourceFile
case specializedAttributeArgument
case specializeAttributeArgumentList
case specializeAvailabilityArgument
case specializeTargetFunctionArgument
Expand Down Expand Up @@ -304,6 +305,7 @@ public enum SyntaxNodeKind: String, CaseIterable, IdentifierConvertible, TypeCon
case unresolvedIsExpr
case unresolvedTernaryExpr
case unsafeExpr
case usingDecl
case valueBindingPattern
case variableDecl
case versionComponent
Expand Down Expand Up @@ -454,6 +456,7 @@ public enum SyntaxNodeKind: String, CaseIterable, IdentifierConvertible, TypeCon
case .someOrAnyType: return "constrainedSugarType"
case .simpleTypeSpecifier: return "typeSpecifier"
case .specializeAttributeArgumentList: return "specializeAttributeSpecList"
case .specializedAttributeArgument: return "specializedAttribute"
case .specializeAvailabilityArgument: return "availabilityEntry"
case .specializeTargetFunctionArgument: return "targetFunctionEntry"
case .stringLiteralSegmentList: return "stringLiteralSegments"
Expand Down
6 changes: 3 additions & 3 deletions CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ public let TYPE_NODES: [Node] = [
base: .type,
experimentalFeature: .inlineArrayTypeSugar,
nameForDiagnostics: "inline array type",
documentation: "An inline array type `[3 x Int]`, sugar for `InlineArray<3, Int>`.",
documentation: "An inline array type `[3 of Int]`, sugar for `InlineArray<3, Int>`.",
children: [
Child(
name: "leftSquare",
Expand All @@ -317,12 +317,12 @@ public let TYPE_NODES: [Node] = [
documentation: """
The `count` argument for the inline array type.

- Note: In semantically valid Swift code, this is always an integer or a wildcard type, e.g `_` in `[_ x Int]`.
- Note: In semantically valid Swift code, this is always an integer or a wildcard type, e.g `_` in `[_ of Int]`.
"""
),
Child(
name: "separator",
kind: .token(choices: [.keyword(.x)])
kind: .token(choices: [.keyword(.of)])
),
Child(
name: "element",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -372,10 +372,11 @@ class ValidateSyntaxNodes: XCTestCase {
message:
"child 'defaultKeyword' has a single keyword as its only token choice and is followed by a colon. It should thus be named 'defaultLabel'"
),
// 'separator' is more descriptive than 'xKeyword'
// 'separator' is more descriptive than 'ofKeyword'
ValidationFailure(
node: .inlineArrayType,
message: "child 'separator' has a single keyword as its only token choice and should thus be named 'xKeyword'"
message:
"child 'separator' has a single keyword as its only token choice and should thus be named 'ofKeyword'"
),
]
)
Expand Down
8 changes: 7 additions & 1 deletion Release Notes/602.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,13 @@
- Pull Request: https://github.com/swiftlang/swift-syntax/pull/3028
- Migration steps: Use `AttributeSyntax.Arguments.argumentList(LabeledExprListSyntax)` instead.
- Notes: Removed cases from `AttributeSyntax.Arguments`: `token(TokenSyntax)`, `string(StringLiteralExprSyntax)`, `conventionArguments(ConventionAttributeArgumentsSyntax)`, `conventionWitnessMethodArguments(ConventionWitnessMethodAttributeArgumentsSyntax)`, `opaqueReturnTypeOfAttributeArguments(OpaqueReturnTypeOfAttributeArgumentsSyntax)`, `exposeAttributeArguments(ExposeAttributeArgumentsSyntax)`, `underscorePrivateAttributeArguments(UnderscorePrivateAttributeArgumentsSyntax)`, and `unavailableFromAsyncArguments(UnavailableFromAsyncAttributeArgumentsSyntax)`. Removed Syntax kinds: `ConventionAttributeArgumentsSyntax`, `ConventionWitnessMethodAttributeArgumentsSyntax`, `OpaqueReturnTypeOfAttributeArgumentsSyntax`, `ExposeAttributeArgumentsSyntax`, `UnderscorePrivateAttributeArgumentsSyntax`, and `UnavailableFromAsyncAttributeArgumentsSyntax`.
,

- `ExpandEditorPlaceholdersToLiteralClosures` & `CallToTrailingClosures` now take a `Syntax` parameter
- Description: These refactorings now take an arbitrary `Syntax` and return a `Syntax?`. If a non-function-like syntax node is passed, `nil` is returned. The previous `FunctionCallExprSyntax` overloads are deprecated.
- Pull Request: https://github.com/swiftlang/swift-syntax/pull/3092
- Migration steps: Insert a `Syntax(...)` initializer call for the argument, and cast the result with `.as(...)` if necessary.
- Notes: This allows the refactorings to correctly handle macro expansion expressions and declarations.

## Template

- *Affected API or two word description*
Expand Down
Loading