mirror of
https://github.com/apple/swift.git
synced 2025-12-21 12:14:44 +01:00
When checking protocol conformances with `@differentiable` requirements, the type checker is supposed to accept omissions of `@differentiable` attributes when there exsits an attribute that covers a superset of the differentiation configuration. This was accidentally regressed in apple/swift#33776 which made the following test case fail to compile. This is fixed by adjusting the witness matching conditions. ```swift // rdar://70348904 reproducer: public protocol P: Differentiable { @differentiable(wrt: self) @differentiable(wrt: (self, x)) func foo(_ x: Float) -> Float } public struct S: P {} extension S { // This had worked until apple/swift#33776. @differentiable(wrt: (self, x)) public func foo(_ x: Float) -> Float { x } } ``` Also fix some suboptimal diagnostics where more information could be shown. Resolves rdar://70348904.