Skip to content

[AutoDiff] Update availability in differentiable function metadata test. #38330

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 1 commit into from
Jul 10, 2021
Merged
Changes from all commits
Commits
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
24 changes: 13 additions & 11 deletions test/AutoDiff/validation-test/function_type_metadata.swift
Original file line number Diff line number Diff line change
Expand Up @@ -61,18 +61,20 @@ if #available(macOS 11.3, iOS 14.5, tvOS 14.5, watchOS 7.4, *) {
}
}

FunctionTypeMetadataTests.test("Reflect generic differentiable function type") {
func testGeneric<T: Differentiable>(_ type: T.Type) {
expectEqual(
"""
@differentiable(reverse) (\(String(reflecting: type))) -> \
\(String(reflecting: type))
""",
String(reflecting: (@differentiable(reverse) (T) -> T).self))
if #available(macOS 12, iOS 15, tvOS 15, watchOS 8, *) {
FunctionTypeMetadataTests.test("Reflect generic differentiable function type") {
func testGeneric<T: Differentiable>(_ type: T.Type) {
expectEqual(
"""
@differentiable(reverse) (\(String(reflecting: type))) -> \
\(String(reflecting: type))
""",
String(reflecting: (@differentiable(reverse) (T) -> T).self))
}
testGeneric(Double.self)
testGeneric([Float].self)
testGeneric(Float?.self)
}
testGeneric(Double.self)
testGeneric([Float].self)
testGeneric(Float?.self)
}

runAllTests()