Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// RUN: not --crash %target-swift-frontend -emit-sil -verify %s
// REQUIRES: asserts

// SR-12744: Pullback generation crash for unhandled indirect result.
// May be due to inconsistent derivative function type calculation logic in
// `VJPEmitter::createEmptyPullback`.

import _Differentiation

class Class: Differentiable {
@differentiable(wrt: (self, x))
@differentiable(wrt: x)
func f(_ x: Float) -> Float { x }
}

func test<C: Class>(_ c: C, _ x: Float) {
_ = gradient(at: c, x) { c, x in c.f(x) }
_ = gradient(at: x) { x in c.f(x) }
}