Skip to content

Commit 1e6bfbd

Browse files
committed
Add TBDGen test.
TBDGen behavior is not expected to change, testing in case.
1 parent af8f483 commit 1e6bfbd

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

test/AutoDiff/tbdgen.swift

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,13 @@
1212
@differentiable public func publicDiffable(_ x: Float, _ y: Float) -> Float { return x }
1313
@differentiable(wrt: (x)) public func publicDiffableWRT(_ x: Float, _ y: Float) -> Float { return x }
1414

15+
// Tests SILGen derivative "forwarding thunk" (no derivative reabstraction/self-reordering).
16+
@differentiable(vjp: publicNoDerivativeReabstractionVJP)
17+
public func publicNoDerivativeReabstraction<T: Differentiable>(_ x: T) -> T { return x }
18+
public func publicNoDerivativeReabstractionVJP<T: Differentiable>(_ x: T) -> (T, (T.TangentVector) -> T.TangentVector) {
19+
return (x, { $0 })
20+
}
21+
1522
@differentiable internal func internalDiffable(_ x: Float, _ y: Float) -> Float { return x }
1623
@differentiable(wrt: (x)) internal func internalDiffableWRT(_ x: Float, _ y: Float) -> Float { return x }
1724

0 commit comments

Comments
 (0)