Skip to content

Commit

Permalink
Fix compile errors for Swift 6 language mode
Browse files Browse the repository at this point in the history
  • Loading branch information
b1ackturtle committed Aug 23, 2024
1 parent 34b1705 commit 135802f
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion Tests/SwiftAlgorithmsTests/GroupedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
import Algorithms

final class GroupedTests: XCTestCase {
private class SampleError: Error {}
private final class SampleError: Error {}

// Based on https://github.com/apple/swift/blob/4d1d8a9de5ebc132a17aee9fc267461facf89bf8/validation-test/stdlib/Dictionary.swift#L1974-L1988

Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftAlgorithmsTests/KeyedTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ import XCTest
import Algorithms

final class KeyedTests: XCTestCase {
private class SampleError: Error {}
private final class SampleError: Error {}

func testUniqueKeys() {
let d = ["Apple", "Banana", "Cherry"].keyed(by: { $0.first! })
Expand Down
2 changes: 1 addition & 1 deletion Tests/SwiftAlgorithmsTests/RandomSampleTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ func validateRandomSamples<S: Sequence>(
_ samples: [Int: Int],
elements: S,
expectedValue: Int,
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) where S.Element == Int {
let expectedRange = ((expectedValue / 3) * 2) ... ((expectedValue / 3) * 4)
XCTAssertEqualSequences(samples.keys.sorted(), elements,
Expand Down
8 changes: 4 additions & 4 deletions Tests/SwiftAlgorithmsTests/TestUtilities.swift
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ func XCTAssertEqualSequences<S1: Sequence, S2: Sequence>(
_ expression1: @autoclosure () throws -> S1,
_ expression2: @autoclosure () throws -> S2,
_ message: @autoclosure () -> String = "",
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where S1.Element: Equatable, S1.Element == S2.Element {
try XCTAssertEqualSequences(expression1(), expression2(), by: ==,
message(), file: file, line: line)
Expand All @@ -88,7 +88,7 @@ func XCTAssertEqualSequences<S1: Sequence, S2: Sequence>(
func XCTAssertUnorderedEqualSequences<S1: Sequence, S2: Sequence>(
_ expression1: @autoclosure () throws -> S1,
_ expression2: @autoclosure () throws -> S2,
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where S1.Element: Equatable, S1.Element == S2.Element {
var s1 = Array(try expression1())
var missing: [S1.Element] = []
Expand Down Expand Up @@ -116,7 +116,7 @@ func XCTAssertEqualSequences<S1: Sequence, S2: Sequence>(
_ expression2: @autoclosure () throws -> S2,
by areEquivalent: (S1.Element, S1.Element) -> Bool,
_ message: @autoclosure () -> String = "",
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where S1.Element == S2.Element {

func fail(_ reason: String) {
Expand Down Expand Up @@ -153,7 +153,7 @@ func XCTAssertEqualCollections<C1: Collection, C2: Collection>(
_ expression1: @autoclosure () throws -> C1,
_ expression2: @autoclosure () throws -> C2,
_ message: @autoclosure () -> String = "",
file: StaticString = #file, line: UInt = #line
file: StaticString = (#file), line: UInt = #line
) rethrows where C1.Element: Equatable, C1.Element == C2.Element {
let c1 = try expression1()
let c2 = try expression2()
Expand Down

0 comments on commit 135802f

Please sign in to comment.