swift
8ffd97ae - [AutoDiff] Make Differentiable derivation support property wrappers.

Commit
5 years ago
[AutoDiff] Make Differentiable derivation support property wrappers. Differentiable conformance derivation now "peers through" property wrappers. Synthesized TangentVector structs contain wrapped properties' TangentVectors as stored properties, not wrappers' TangentVectors. Property wrapper types are not required to conform to `Differentiable`. Property wrapper types are required to provide `wrappedValue.set`, which is needed to synthesize `mutating func move(along:)`. ``` import _Differentiation @propertyWrapper struct Wrapper<Value> { var wrappedValue: Value } struct Struct: Differentiable { @Wrapper var x: Float = 0 // Compiler now synthesizes: // struct TangentVector: Differentiable & AdditiveArithmetic { // var x: Float // ... // } } ``` Resolves SR-12638.
Author
Committer
Parents
Loading