Closed tachyonics closed 3 years ago
@swift-ci create
This behaves correctly. There is no such thing as a local override of a protocol conformance - in fact, protocol conformances are required to be globally unique or you may run into runtime instabilities. What you are observing in the former case is name lookup preferring operators defined within the same module as the use. In the latter case, the lookup occurs against the requirements of Equatable, and so selects the operator that dispatches through the witness table for the conformance of the type to the protocol.
Environment
Swift 5.4.3, Amazon LinuxAdditional Detail from JIRA
| | | |------------------|-----------------| |Votes | 0 | |Component/s | | |Labels | Bug | |Assignee | None | |Priority | Medium | md5: 9450cc35a37b53d6fdaf489b7b262598Issue Description:
We have just encountered an issue where there is inconsistent behaviour when overriding Equatable conformance across packages and using generic functions.
In Package 1 -
In Package 2 -
Create an extension that overrides the Equatable conformance that is different to the compiler-synthesised conformance.
In a first test, test equality directly in a non-generic function
In a second test, test equality in a generic function where the generic parameter extends Equatable.
We would expect the results of both equality tests to use the package-local conformance override. However we observed -
the equality test in the non-generic function to use the override conformance. This is what we would expect.
the equality test in the generic function to use the original compiler-synthesised conformance. This is not the result we would expect.