Skip to content

Merge main into release/6.2 #3122

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
49 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
902e76e
Fix a crash if we had a dollar identifier as the second parameter lab…
ahoppen Jun 16, 2025
e8c3dcf
Merge pull request #3104 from ahoppen/argument-label-crash
hamishknight Jun 16, 2025
c4f53b3
.swift-format: Enable `ReturnVoidInsteadOfEmptyTuple`
AnthonyLatsis Jun 20, 2025
c186fe3
Add "late specifiers" to attributed types.
DougGregor Jun 23, 2025
6ecd032
Regenerate syntax nodes
DougGregor Jun 23, 2025
1856087
Parse "late" specifiers for type attributes
DougGregor Jun 23, 2025
1710601
Formatting
DougGregor Jun 23, 2025
75583ab
Only parse 'nonisolated' as a specifier when we can have specifiers
DougGregor Jun 23, 2025
ec9139e
Fix tests
DougGregor Jun 23, 2025
7eca32c
Merge pull request #3112 from DougGregor/parse-unsafe-nonisolated-con…
DougGregor Jun 24, 2025
a298b41
Improve formatting
DougGregor Jun 24, 2025
eeaf6e8
[MacroExamples] AddAsync: Handle implicit `Void` result
AnthonyLatsis Jun 25, 2025
74a8c07
.swift-format: Enable `NoVoidReturnOnFunctionSignature`
AnthonyLatsis Jun 25, 2025
58fdc3b
Merge pull request #3114 from DougGregor/improve-formatting
DougGregor Jun 25, 2025
c40a978
Merge pull request #3110 from swiftlang/jepa
AnthonyLatsis Jun 25, 2025
28c2a43
Avoid eating `"""` as closing `"` delimiter
hamishknight Jun 27, 2025
b73055f
Merge pull request #3116 from hamishknight/air-quotes
hamishknight Jul 1, 2025
fdaf1be
SwiftIDEUtilsTest: Add tests for `FixItApplier`
AnthonyLatsis Jul 1, 2025
a6162a5
SwiftSyntax: Conform `AbsolutePosition` to `Strideable`
AnthonyLatsis Jul 2, 2025
9084149
FixItApplier: Accept syntax tree generically
AnthonyLatsis Jul 2, 2025
b953b57
FixItApplier: Eliminate quadratic `compactMap`
AnthonyLatsis Jul 1, 2025
b3270fe
FixItApplier: Eliminate quadratic `dropFirst`
AnthonyLatsis Jul 2, 2025
df0f832
FixItApplier: Add parameter for skipping duplicate insertions
AnthonyLatsis Jul 2, 2025
a00cbca
FixItApplier: Non-empty insertions can conflict with other edits
AnthonyLatsis Jul 2, 2025
638901a
Merge pull request #3121 from swiftlang/jepa2
AnthonyLatsis Jul 4, 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
4 changes: 3 additions & 1 deletion .swift-format
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
"NoBlockComments": false,
"OrderedImports": true,
"UseLetInEveryBoundCaseVariable": false,
"UseSynthesizedInitializer": false
"UseSynthesizedInitializer": false,
"ReturnVoidInsteadOfEmptyTuple": true,
"NoVoidReturnOnFunctionSignature": true,
}
}
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
9 changes: 5 additions & 4 deletions CodeGeneration/Sources/SyntaxSupport/Child.swift
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ public enum ChildKind {
kind: SyntaxNodeKind,
collectionElementName: String? = nil,
defaultsToEmpty: Bool = false,
deprecatedCollectionElementName: String? = nil
deprecatedCollectionElementName: String? = nil,
generateDeprecatedAddFunction: Bool = true
)
/// The child is a token that matches one of the given `choices`.
/// If `requiresLeadingSpace` or `requiresTrailingSpace` is not `nil`, it
Expand Down Expand Up @@ -132,7 +133,7 @@ public class Child: NodeChoiceConvertible {
return kind
case .nodeChoices:
return .syntax
case .collection(kind: let kind, _, _, _):
case .collection(kind: let kind, _, _, _, _):
return kind
case .token:
return .token
Expand Down Expand Up @@ -268,7 +269,7 @@ public class Child: NodeChoiceConvertible {
/// Whether this child has syntax kind `UnexpectedNodes`.
public var isUnexpectedNodes: Bool {
switch kind {
case .collection(kind: .unexpectedNodes, _, _, _):
case .collection(kind: .unexpectedNodes, _, _, _, _):
return true
default:
return false
Expand All @@ -283,7 +284,7 @@ public class Child: NodeChoiceConvertible {
return choices.isEmpty
case .node(let kind):
return kind.isBase
case .collection(kind: let kind, _, _, _):
case .collection(kind: let kind, _, _, _, _):
return kind.isBase
case .token:
return false
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
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ struct GrammarGenerator {
case .nodeChoices(let choices, _):
let choicesDescriptions = choices.map { grammar(for: $0) }
return "(\(choicesDescriptions.joined(separator: " | ")))\(optionality)"
case .collection(kind: let kind, _, _, _):
case .collection(kind: let kind, _, _, _, _):
return "\(kind.doccLink)\(optionality)"
case .token(let choices, _, _):
if choices.count == 1 {
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
2 changes: 1 addition & 1 deletion CodeGeneration/Sources/SyntaxSupport/Node.swift
Original file line number Diff line number Diff line change
Expand Up @@ -391,7 +391,7 @@ fileprivate extension Child {
return [kind]
case .nodeChoices(let choices, _):
return choices.flatMap(\.kinds)
case .collection(kind: let kind, _, _, _):
case .collection(kind: let kind, _, _, _, _):
return [kind]
case .token:
return [.token]
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
17 changes: 14 additions & 3 deletions CodeGeneration/Sources/SyntaxSupport/TypeNodes.swift
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ public let TYPE_NODES: [Node] = [
kind: .collection(kind: .attributeList, collectionElementName: "Attribute", defaultsToEmpty: true),
documentation: "A list of attributes that can be attached to the type, such as `@escaping`."
),
Child(
name: "lateSpecifiers",
kind: .collection(
kind: .typeSpecifierList,
collectionElementName: "Specifier",
defaultsToEmpty: true,
generateDeprecatedAddFunction: false
),
documentation:
"A list of specifiers that can be attached to the type after the attributes, such as 'nonisolated'."
),
Child(
name: "baseType",
kind: .node(kind: .type),
Expand Down Expand Up @@ -304,7 +315,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 +328,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
Loading