|
1 | 1 | // RUN: %target-run-simple-swift
|
2 | 2 | // REQUIRES: executable_test
|
3 | 3 |
|
4 |
| -// rdar://76039256 |
5 |
| -// UNSUPPORTED: use_os_stdlib |
6 |
| - |
7 | 4 | import StdlibUnittest
|
8 | 5 | import _Differentiation
|
9 | 6 |
|
10 | 7 | var FunctionTypeMetadataTests = TestSuite("FunctionTypeMetadata")
|
11 | 8 |
|
12 |
| -FunctionTypeMetadataTests.test("Reflect differentiable function type") { |
13 |
| - expectEqual( |
14 |
| - "@differentiable(reverse) (Swift.Float) -> Swift.Float", |
15 |
| - String(reflecting: (@differentiable(reverse) (Float) -> Float).self)) |
16 |
| - expectEqual( |
17 |
| - "@differentiable(reverse) (inout Swift.Float) -> ()", |
18 |
| - String(reflecting: (@differentiable(reverse) (inout Float) -> Void).self)) |
19 |
| - expectEqual( |
20 |
| - """ |
21 |
| - @differentiable(reverse) (Swift.Array<Swift.Float>) -> \ |
22 |
| - Swift.Array<Swift.Float> |
23 |
| - """, |
24 |
| - String(reflecting: (@differentiable(reverse) ([Float]) -> [Float]).self)) |
25 |
| - expectEqual( |
26 |
| - """ |
27 |
| - @differentiable(reverse) (Swift.Optional<Swift.Float>) -> \ |
28 |
| - Swift.Optional<Swift.Float> |
29 |
| - """, |
30 |
| - String(reflecting: (@differentiable(reverse) (Float?) -> Float?).self)) |
31 |
| - // FIXME(rdar://75916833): Mangle '@noDerivative' in function types. |
32 |
| - // expectEqual( |
33 |
| - // """ |
34 |
| - // @differentiable(reverse) (Swift.Optional<Swift.Float>, \ |
35 |
| - // @noDerivative Swift.Int) -> Swift.Optional<Swift.Float> |
36 |
| - // """, |
37 |
| - // String(reflecting: ( |
38 |
| - // @differentiable(reverse) (Float?, @noDerivative Int) -> Float?).self)) |
| 9 | +if #available(macOS 9999, iOS 9999, watchOS 9999, tvOS 9999, *) { |
| 10 | + FunctionTypeMetadataTests.test("Reflect differentiable function type") { |
| 11 | + expectEqual( |
| 12 | + "@differentiable(reverse) (Swift.Float) -> Swift.Float", |
| 13 | + String(reflecting: (@differentiable(reverse) (Float) -> Float).self)) |
| 14 | + expectEqual( |
| 15 | + "@differentiable(reverse) (inout Swift.Float) -> ()", |
| 16 | + String(reflecting: (@differentiable(reverse) (inout Float) -> Void).self)) |
| 17 | + expectEqual( |
| 18 | + """ |
| 19 | + @differentiable(reverse) (Swift.Array<Swift.Float>) -> \ |
| 20 | + Swift.Array<Swift.Float> |
| 21 | + """, |
| 22 | + String(reflecting: (@differentiable(reverse) ([Float]) -> [Float]).self)) |
| 23 | + expectEqual( |
| 24 | + """ |
| 25 | + @differentiable(reverse) (Swift.Optional<Swift.Float>) -> \ |
| 26 | + Swift.Optional<Swift.Float> |
| 27 | + """, |
| 28 | + String(reflecting: (@differentiable(reverse) (Float?) -> Float?).self)) |
| 29 | + // FIXME(rdar://75916833): Mangle '@noDerivative' in function types. |
| 30 | + // expectEqual( |
| 31 | + // """ |
| 32 | + // @differentiable(reverse) (Swift.Optional<Swift.Float>, \ |
| 33 | + // @noDerivative Swift.Int) -> Swift.Optional<Swift.Float> |
| 34 | + // """, |
| 35 | + // String(reflecting: ( |
| 36 | + // @differentiable(reverse) (Float?, @noDerivative Int) -> Float?).self)) |
| 37 | + } |
39 | 38 | }
|
40 | 39 |
|
41 | 40 | // FIXME(rdar://75916878): Investigate why reflecting differentiable function
|
|
0 commit comments