forked from swiftlang/swift
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[AutoDiff] [Sema] Include certain 'let' properties in 'Differentiable…
…' derived conformances. Today, `let` properties are treated as if they had `@noDerivative` and excluded from the derived `Differentaible` conformance implementation. This is limiting to properties that have a non-mutating `move(along:)` (e.g. class properties), which can be mathematically treated as differentiable variables. This patch changes the derived conformances behavior such that `let` properties will be included as differentiable variables if they have a non-mutating 'move(along:)'. This unblocks the following code: ```swift class Foo: Differentiable { let x: ClassStuff // Class type // Synthesized code: // struct TangentVector { // var x: ClassStuff.TangentVector // } // ... // func move(along direction: TangentVector) { // x.move(along: direction.x) // } } ``` Resolves SR-13474 (rdar://67982207).
- Loading branch information
Showing
5 changed files
with
147 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters