Skip to content

Merge main into release/6.2 #3052

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

Merged
merged 21 commits into from
Apr 17, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
848e5fe
Fix build warning
ahoppen Mar 28, 2025
c8f189e
[bazel] Add new C files
keith Apr 1, 2025
52c4bc2
Include try and await expressions which are parents of a freestanding…
stmontgomery Jul 10, 2024
2b9a763
Handle `try` and `await` in unfolded sequences
hamishknight Apr 1, 2025
2c16aeb
Add `unsafe` as a lexical context too
hamishknight Apr 3, 2025
09ea403
Merge pull request #3037 from hamishknight/in-sequence
hamishknight Apr 4, 2025
660b9a1
[Windows] Remove extra newlines from diagnostic output.
al45tair Apr 3, 2025
820501e
Add dependencies to SwiftSyntax60[12] (#3034)
mbrandonw Apr 4, 2025
6c53107
Merge pull request #3039 from al45tair/eng/PR-148520063
al45tair Apr 6, 2025
f650d77
Merge pull request #3031 from ahoppen/fix-build-warning
ahoppen Apr 7, 2025
f1261c0
Merge pull request #3035 from keith/ks/bazel-add-new-c-files
ahoppen Apr 7, 2025
2fcf9c4
Don’t exclude 5.8 in PR testing
ahoppen Apr 7, 2025
491c5c9
Add concurrency control to cancel in-progress PR workflows (#3042)
TTOzzi Apr 7, 2025
1637566
Removes duplicate trivia from UnsafeExprSyntax
TTOzzi Apr 5, 2025
367883a
Merge pull request #3043 from TTOzzi/unsafe-leading-trivia
ahoppen Apr 9, 2025
ea77686
Change default release version to 603.0.0
ahoppen Apr 9, 2025
a292dd3
Merge pull request #3045 from ahoppen/remove-58-pr-testing
ahoppen Apr 9, 2025
0ef1dc3
Add SwiftSyntax603 version marker module
ahoppen Apr 9, 2025
7ba88aa
Merge pull request #3050 from ahoppen/default-release-version
ahoppen Apr 10, 2025
544cbae
Merge branch 'main' into merge-main-6.2-2025-04-10
ahoppen Apr 10, 2025
b9df7d0
Revert "Add SwiftSyntax603 version marker module"
ahoppen Apr 10, 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
6 changes: 4 additions & 2 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ on:
pull_request:
types: [opened, reopened, synchronize]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
tests:
name: Test
uses: swiftlang/github-workflows/.github/workflows/swift_package_test.yml@main
with:
linux_exclude_swift_versions: "[{\"swift_version\": \"5.8\"}]"
soundness:
name: Soundness
uses: swiftlang/github-workflows/.github/workflows/soundness.yml@main
Expand Down
10 changes: 10 additions & 0 deletions BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ swift_syntax_library(
":SwiftSyntax509",
":SwiftSyntax510",
":SwiftSyntax600",
":SwiftSyntax601",
":SwiftSyntax602",
":_SwiftSyntaxCShims",
],
)
Expand Down Expand Up @@ -251,6 +253,13 @@ swift_syntax_library(
],
)

swift_syntax_library(
name = "SwiftSyntax602",
srcs = glob(["Sources/VersionMarkerModules/SwiftSyntax602/**/*.swift"]),
deps = [
],
)

swift_syntax_library(
name = "SwiftSyntaxBuilder",
deps = [
Expand Down Expand Up @@ -376,6 +385,7 @@ cc_library(

cc_library(
name = "_SwiftSyntaxCShims",
srcs = glob(["Sources/_SwiftSyntaxCShims/*.c"]),
hdrs = glob(["Sources/_SwiftSyntaxCShims/include/*.h"]),
includes = ["Sources/_SwiftSyntaxCShims/include"],
tags = ["swift_module=_SwiftSyntaxCShims"],
Expand Down
4 changes: 3 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -210,7 +210,9 @@ let package = Package(

.target(
name: "SwiftSyntax",
dependencies: ["_SwiftSyntaxCShims", "SwiftSyntax509", "SwiftSyntax510", "SwiftSyntax600"],
dependencies: [
"_SwiftSyntaxCShims", "SwiftSyntax509", "SwiftSyntax510", "SwiftSyntax600", "SwiftSyntax601", "SwiftSyntax602",
],
exclude: ["CMakeLists.txt"],
swiftSettings: swiftSyntaxSwiftSettings
),
Expand Down
18 changes: 13 additions & 5 deletions Sources/SwiftDiagnostics/DiagnosticsFormatter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -293,10 +293,13 @@ public struct DiagnosticsFormatter {
)
)

// If the line did not end with \n (e.g. the last line), append it manually
if annotatedSource.last != "\n" {
annotatedSource.append("\n")
// Remove any trailing newline and replace it; this may seem
// counterintuitive, but if we're running within CMake and we let a
// '\r\n' through, CMake will turn that into *two* newlines.
if let last = annotatedSource.last, last.isNewline {
annotatedSource.removeLast()
}
annotatedSource.append("\n")

let columnsWithDiagnostics = Set(
annotatedLine.diagnostics.map {
Expand Down Expand Up @@ -331,8 +334,13 @@ public struct DiagnosticsFormatter {
}

// Add suffix text.
annotatedSource.append(annotatedLine.suffixText)
if annotatedSource.last != "\n" {
if !annotatedLine.suffixText.isEmpty {
annotatedSource.append(annotatedLine.suffixText)

// See above for an explanation of why we do this
if let last = annotatedSource.last, last.isNewline {
annotatedSource.removeLast()
}
annotatedSource.append("\n")
}
}
Expand Down
4 changes: 1 addition & 3 deletions Sources/SwiftOperators/OperatorTable+Folding.swift
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ extension OperatorTable {
if let unsafeExpr = lhs.as(UnsafeExprSyntax.self) {
return ExprSyntax(
UnsafeExprSyntax(
leadingTrivia: unsafeExpr.leadingTrivia,
unsafeExpr.unexpectedBeforeUnsafeKeyword,
unsafeKeyword: unsafeExpr.unsafeKeyword,
unsafeExpr.unexpectedBetweenUnsafeKeywordAndExpression,
Expand All @@ -150,8 +149,7 @@ extension OperatorTable {
op: op,
rhs: rhs
),
unsafeExpr.unexpectedAfterExpression,
trailingTrivia: unsafeExpr.trailingTrivia
unsafeExpr.unexpectedAfterExpression
)
)
}
Expand Down
4 changes: 4 additions & 0 deletions Sources/VersionMarkerModules/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,7 @@ add_library(${SWIFTSYNTAX_TARGET_NAMESPACE}SwiftSyntax510 STATIC
SwiftSyntax509/Empty.swift)
add_library(${SWIFTSYNTAX_TARGET_NAMESPACE}SwiftSyntax600 STATIC
SwiftSyntax509/Empty.swift)
add_library(${SWIFTSYNTAX_TARGET_NAMESPACE}SwiftSyntax601 STATIC
SwiftSyntax509/Empty.swift)
add_library(${SWIFTSYNTAX_TARGET_NAMESPACE}SwiftSyntax602 STATIC
SwiftSyntax509/Empty.swift)
6 changes: 6 additions & 0 deletions Tests/SwiftOperatorsTest/OperatorTableTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -435,4 +435,10 @@ class OperatorPrecedenceTests: XCTestCase {
}

}

func testTriviaAroundUnsafeExpr() throws {
let original = ExprSyntax("/*leading*/ unsafe a /*trailing*/ + b")
let folded = try OperatorTable.standardOperators.foldAll(original)
XCTAssertEqual(original.description, folded.description)
}
}