Skip to content

Commit 44d9c67

Browse files
committed
Add test 2/2
1 parent 834871e commit 44d9c67

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

test/AutoDiff/Sema/differentiable_func_type.swift

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,6 @@ let _: @differentiable(reverse) (Float) throws -> Float
1818

1919
struct NonDiffType { var x: Int }
2020

21-
// FIXME: Properly type-check parameters and the result's differentiability
2221
// expected-error @+1 {{parameter type 'NonDiffType' does not conform to 'Differentiable', but the enclosing function type is '@differentiable'}}
2322
let _: @differentiable(reverse) (NonDiffType) -> Float
2423

@@ -41,6 +40,12 @@ let _: @differentiable(_linear) (Float) -> NonDiffType
4140

4241
let _: @differentiable(_linear) (Float) -> Float
4342

43+
// expected-error @+1 {{'@differentiable' function type cannot have both an 'inout' parameter and a differentiable result}}
44+
let _: @differentiable(reverse) (inout Float) -> Float
45+
46+
// expected-error @+1 {{'@differentiable' function type cannot have both an 'inout' parameter and a differentiable result}}
47+
let _: @differentiable(_linear) (inout Float) -> Float
48+
4449
// expected-error @+1 {{result type '@differentiable(reverse) (U) -> Float' does not conform to 'Differentiable', but the enclosing function type is '@differentiable'}}
4550
func test1<T: Differentiable, U: Differentiable>(_: @differentiable(reverse) (T) -> @differentiable(reverse) (U) -> Float) {}
4651
// expected-error @+1 {{result type '(U) -> Float' does not conform to 'Differentiable', but the enclosing function type is '@differentiable'}}

0 commit comments

Comments
 (0)