Open JaapWijnen opened 1 month ago
tagging @asl
Tagging @slavapestov as well
Reduction:
import _Differentiation
struct Wrapper<T> {
func read(_ t: T) -> T {
return t
}
}
protocol P {
associatedtype T: Differentiable
@differentiable(reverse)
func read(_: T) -> T
}
extension Wrapper: P where T: Differentiable {}
Tagging @rxwei
@asl The debug output tells you everything you need to know. It's a bug in your code:
getReducedType() was called
with <τ_0_0 where τ_0_0 : Copyable, τ_0_0 : Escapable>,
and () -> (τ_0_0, (Wrapper<τ_0_0>.TangentVector) -> τ_0_0.TangentVector).
This type contains the type parameter τ_0_0.TangentVector.
This type parameter's reduced term is τ_0_0.[Differentiable:TangentVector].
This is not a valid term, because τ_0_0 does not have a member type named [Differentiable:TangentVector].
This usually indicates the caller passed the wrong type or generic signature to getReducedType().
@asl The debug output tells you everything you need to know. It's a bug in your code:
Thanks! I did not notice that there is actually autodiff-related function in the stack trace. I will double check what is going on... T (τ_0_0
) should conform to Differentiable
so it should have TangentVector
associated type.
Description
when conforming a type to a protocol that has marked a method with
@differentiable
I get a crash.Reproduction
Stack dump
Expected behavior
Expected to not crash. Either give a diagnostic or compile successfully.
Environment
Apple Swift version 6.0-dev (LLVM 2fec3215a5e087f, Swift d4339198dcfd073) Target: arm64-apple-macosx14.0
Additional information
No response