Skip to content

Commit

Permalink
Merge pull request #731 from ahoppen/6.0/merge-main-2024-05-01
Browse files Browse the repository at this point in the history
Merge `main` into `release/6.0`
  • Loading branch information
ahoppen authored May 2, 2024
2 parents c7912e1 + b0ac22e commit 122fb7e
Show file tree
Hide file tree
Showing 12 changed files with 60 additions and 9 deletions.
5 changes: 5 additions & 0 deletions .swiftci/5_10_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.10-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/5_7_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.7-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/5_8_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.8-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/5_9_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
swift_version_tag = "5.9-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_6_0_macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
macOSSwiftPackageJob {
swift_version = "6.0"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_6_0_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
nightly_docker_tag = "nightly-6.0-jammy"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_main_macos
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
macOSSwiftPackageJob {
swift_version = "main"
repo = "swift-format"
branch = "main"
}
5 changes: 5 additions & 0 deletions .swiftci/nightly_main_ubuntu2204
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
LinuxSwiftPackageJob {
nightly_docker_tag = "nightly-jammy"
repo = "swift-format"
branch = "main"
}
7 changes: 7 additions & 0 deletions .swiftci/nightly_main_windows
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
WindowsSwiftPackageWithDockerImageJob {
docker_image = "swiftlang/swift:nightly-windowsservercore-1809"
repo = "swift-format"
branch = "main"
sub_dir = "swift-format"
label = "windows-server-2019"
}
2 changes: 1 addition & 1 deletion Documentation/RuleDocumentation.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

Use the rules below in the `rules` block of your `.swift-format`
configuration file, as described in
[Configuration](Documentation/Configuration.md). All of these rules can be
[Configuration](Configuration.md). All of these rules can be
applied in the linter, but only some of them can format your source code
automatically.

Expand Down
8 changes: 0 additions & 8 deletions Sources/SwiftFormat/PrettyPrint/TokenStreamCreator.swift
Original file line number Diff line number Diff line change
Expand Up @@ -1350,14 +1350,6 @@ fileprivate final class TokenStreamCreator: SyntaxVisitor {
}

override func visit(_ node: EnumCaseParameterClauseSyntax) -> SyntaxVisitorContinueKind {
// Prioritize keeping ") throws -> <return_type>" together. We can only do this if the function
// has arguments.
if !node.parameters.isEmpty && config.prioritizeKeepingFunctionOutputTogether {
// Due to visitation order, this .open corresponds to a .close added in FunctionDeclSyntax
// or SubscriptDeclSyntax.
before(node.rightParen, tokens: .open)
}

return .visitChildren
}

Expand Down
12 changes: 12 additions & 0 deletions Tests/SwiftFormatTests/PrettyPrint/EnumDeclTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -559,4 +559,16 @@ final class EnumDeclTests: PrettyPrintTestCase {
let input = "enum Foo { var bar: Int }"
assertPrettyPrintEqual(input: input, expected: input + "\n", linelength: 50)
}

func testEnumWithPrioritizeKeepingFunctionOutputTogetherFlag() {
let input = """
enum Error {
case alreadyOpen(Int)
}
"""
var config = Configuration.forTesting
config.prioritizeKeepingFunctionOutputTogether = true
assertPrettyPrintEqual(input: input, expected: input, linelength: 50, configuration: config)
}
}

0 comments on commit 122fb7e

Please sign in to comment.