Skip to content

Commit

Permalink
Remove dynamicCast
Browse files Browse the repository at this point in the history
The test case will fail on macOS 13+Xcode 15.1.
My macOS 14 + Xcode 15 will not fail.
CI’s original macOS 12 + Xcode 14.3.1 will also not fail.
  • Loading branch information
Kyle-Ye committed Dec 20, 2023
1 parent b30d40d commit 00f0abf
Showing 1 changed file with 1 addition and 18 deletions.
19 changes: 1 addition & 18 deletions Tests/OpenCombineTests/PublisherTests/FutureTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,6 @@ import Combine
import OpenCombine
#endif

// swiftlint:disable generic_type_name
/// See https://forums.swift.org/t/casting-from-any-to-optional/21883
private func dynamicCast<T>(_ value: Any, to: T.Type) -> T? {
if let value = value as? T {
return value
} else {
return nil
}
}
// swiftlint:enable generic_type_name

@available(macOS 10.15, iOS 13.0, *)
Expand All @@ -42,15 +33,7 @@ final class FutureTests: XCTestCase {
return
}

let parentAsSut: Sut?

do {
parentAsSut = try XCTUnwrap(dynamicCast(parent.value, to: Sut?.self))
} catch {
XCTFail("Unexpected type of the 'parent' property: \(parent.value)")
return
}

let parentAsSut = parent.value as? Sut
if isNil {
XCTAssertNil(parentAsSut)
} else {
Expand Down

0 comments on commit 00f0abf

Please sign in to comment.