swift
272509dd - [Autodiff] Add checks that @autodiff annotated functions are well-formed. (#22201)

Commit
6 years ago
[Autodiff] Add checks that @autodiff annotated functions are well-formed. (#22201) Well formedness involves: - All argument parameters should be differentiable or labeled @nondiff - The result type should be differentiable. - Types are considered differentiable if they have a Tangent vector space. This should resolve SR-9448 and SR-9097. Here is an example of the output from these checks: test3.swift: error: argument is not differentiable, but the enclosing function type is marked '@autodiff'; did you want to add '@nondiff' to this argument? let _: @autodiff (NonDiffType) -> Float ^ @nondiff test3.swift: error: result is not differentiable, but the function type is marked '@autodiff' let _: @autodiff (Float) -> NonDiffType ^~~~~~~~~~~
Author
Committer
Parents
Loading