swift
swift copied to clipboard
[SR-14229] [AutoDiff] conformance of synthesized TangentVector doesn't work
| Previous ID | SR-14229 |
| Radar | rdar://problem/81170168 |
| Original Reporter | @marcrasi |
| Type | Bug |
Additional Detail from JIRA
| Votes | 0 |
| Component/s | Compiler |
| Labels | Bug, AutoDiff |
| Assignee | None |
| Priority | Medium |
md5: 02544c29a1fa7eb644c287b7535e0342
is duplicated by:
- SR-14959 [AutoDiff] Declaring protocol conformances for synthesized TangentVectors sometimes doesn't do anything
Issue Description:
Code:
public protocol P {}
public struct S: Differentiable {
var x: Float = 0
public init() {}
//public struct TangentVector: AdditiveArithmetic, Differentiable {
// var x: Float = 0
//}
//public func move(along direction: TangentVector) { fatalError() }
}
extension S.TangentVector: P {}
func f<T: Differentiable>(_ t: T) where T.TangentVector: P {}
f(S())
Error:
module.swift:17:1: error: global function 'f' requires that 'S.TangentVector' conform to 'P'
f(S())
^
module.swift:15:6: note: where 'T.TangentVector' = 'S.TangentVector'
func f<T: Differentiable>(_ t: T) where T.TangentVector: P {}
^
This seems related to the synthesis because if you uncomment the custom TangentVector it compiles successfully.
@swift-ci create
Issue still exists on 05/24 toolchain.