From b1cf3c381d602678ceadf228fc13d493390a3afe Mon Sep 17 00:00:00 2001 From: ichiho Date: Tue, 18 Jun 2024 13:20:16 +0900 Subject: [PATCH] Fix compile errors for Swift 6 language mode --- Tests/SwiftAlgorithmsTests/GroupedTests.swift | 2 +- Tests/SwiftAlgorithmsTests/KeyedTests.swift | 2 +- Tests/SwiftAlgorithmsTests/RandomSampleTests.swift | 2 +- Tests/SwiftAlgorithmsTests/TestUtilities.swift | 8 ++++---- 4 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/SwiftAlgorithmsTests/GroupedTests.swift b/Tests/SwiftAlgorithmsTests/GroupedTests.swift index 579016c4..83b24916 100644 --- a/Tests/SwiftAlgorithmsTests/GroupedTests.swift +++ b/Tests/SwiftAlgorithmsTests/GroupedTests.swift @@ -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 diff --git a/Tests/SwiftAlgorithmsTests/KeyedTests.swift b/Tests/SwiftAlgorithmsTests/KeyedTests.swift index 53b1c989..282b2862 100644 --- a/Tests/SwiftAlgorithmsTests/KeyedTests.swift +++ b/Tests/SwiftAlgorithmsTests/KeyedTests.swift @@ -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! }) diff --git a/Tests/SwiftAlgorithmsTests/RandomSampleTests.swift b/Tests/SwiftAlgorithmsTests/RandomSampleTests.swift index cde4d266..06c7d136 100644 --- a/Tests/SwiftAlgorithmsTests/RandomSampleTests.swift +++ b/Tests/SwiftAlgorithmsTests/RandomSampleTests.swift @@ -16,7 +16,7 @@ func validateRandomSamples( _ samples: [Int: Int], elements: S, expectedValue: Int, - file: StaticString = #file, line: UInt = #line + file: StaticString = #filePath, line: UInt = #line ) where S.Element == Int { let expectedRange = ((expectedValue / 3) * 2) ... ((expectedValue / 3) * 4) XCTAssertEqualSequences(samples.keys.sorted(), elements, diff --git a/Tests/SwiftAlgorithmsTests/TestUtilities.swift b/Tests/SwiftAlgorithmsTests/TestUtilities.swift index fbd70bec..fa566f96 100644 --- a/Tests/SwiftAlgorithmsTests/TestUtilities.swift +++ b/Tests/SwiftAlgorithmsTests/TestUtilities.swift @@ -78,7 +78,7 @@ func XCTAssertEqualSequences( _ expression1: @autoclosure () throws -> S1, _ expression2: @autoclosure () throws -> S2, _ message: @autoclosure () -> String = "", - file: StaticString = #file, line: UInt = #line + file: StaticString = #filePath, line: UInt = #line ) rethrows where S1.Element: Equatable, S1.Element == S2.Element { try XCTAssertEqualSequences(expression1(), expression2(), by: ==, message(), file: file, line: line) @@ -88,7 +88,7 @@ func XCTAssertEqualSequences( func XCTAssertUnorderedEqualSequences( _ expression1: @autoclosure () throws -> S1, _ expression2: @autoclosure () throws -> S2, - file: StaticString = #file, line: UInt = #line + file: StaticString = #filePath, line: UInt = #line ) rethrows where S1.Element: Equatable, S1.Element == S2.Element { var s1 = Array(try expression1()) var missing: [S1.Element] = [] @@ -116,7 +116,7 @@ func XCTAssertEqualSequences( _ expression2: @autoclosure () throws -> S2, by areEquivalent: (S1.Element, S1.Element) -> Bool, _ message: @autoclosure () -> String = "", - file: StaticString = #file, line: UInt = #line + file: StaticString = #filePath, line: UInt = #line ) rethrows where S1.Element == S2.Element { func fail(_ reason: String) { @@ -153,7 +153,7 @@ func XCTAssertEqualCollections( _ expression1: @autoclosure () throws -> C1, _ expression2: @autoclosure () throws -> C2, _ message: @autoclosure () -> String = "", - file: StaticString = #file, line: UInt = #line + file: StaticString = #filePath, line: UInt = #line ) rethrows where C1.Element: Equatable, C1.Element == C2.Element { let c1 = try expression1() let c2 = try expression2()