-
Notifications
You must be signed in to change notification settings - Fork 10.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[AutoDiff] Fix incorrectly sorted members of synthesized 'TangentVector'. #36154
Conversation
@CodaFi With this fix, things seems to work fine without the need to manually evaluate struct TangentVector : AdditiveArithmetic, Differentiable {
@_hasStorage var simd: Array<Float>.DifferentiableView { get set }
@_hasStorage var scalar: Float { get set }
init(simd: Array<Float>.DifferentiableView, scalar: Float)
typealias TangentVector = Thing.TangentVector
static var zero: Thing.TangentVector { get }
static func + (lhs: Thing.TangentVector, rhs: Thing.TangentVector) -> Thing.TangentVector
static func - (lhs: Thing.TangentVector, rhs: Thing.TangentVector) -> Thing.TangentVector
static func __derived_struct_equals(_ a: Thing.TangentVector, _ b: Thing.TangentVector) -> Bool
} I also tried your other suggestion to call |
@swift-ci please test |
Build failed |
Build failed |
@swift-ci please test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We should make this specific to TangentVector
, not cover all implicit decls.
@rxwei Perhaps either the getParsedMembers() or getMembers() request on TangentVector should be where the stored properties are generated? |
They are generated by the parent decl's conformance request, since |
I attempted calling |
…or'. Do not mark synthesized `TangentVector` members as synthesized so that the type checker won't sort them. We would like tangent vector members to have the same order as the properties in the parent declaration. Also add `typealias TangentVector = Self` to the synthesized `TangentVector` so that it will not need its own `Differentiable` conformance derivation. Resolves SR-14241 / rdar://74659803.
@swift-ci please test |
Since this change is now local to |
Do not mark synthesized
TangentVector
members as synthesized so that the type checker won't sort them. We would like tangent vector members to have the same order as the properties in the parent declaration.Also add
typealias TangentVector = Self
to the synthesizedTangentVector
so that it will not need its ownDifferentiable
conformance derivation.Resolves SR-14241 / rdar://74659803.