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
[SR-6556] Sourcery source breakage: error: ambiguous use of 'trackDifference(actual:expected:)' #49106
Comments
Pavel, can you take a look at this? I recall you made some changes related to ranking recently and I wonder if that caused this. |
@rudkx This appears to be actually ambiguous if we account for Dictionary to be Equatable, here is the reduced example:
I think it might be due to the missing break in SolutionDiff I've fixed, but I think it's a legitimate problem which needs to be addressed by the project. |
@DougGregor Can this actually be related to conditional conformances? Since I think @moiseev mentioned that dictionary is equatable how if the elements are. |
The second foo should be more specific, because you can use its parameters to call the first foo, but not vice-versa. It'd be interesting to know why that isn't working. |
@DougGregor It looks like we currently don't have ranking rules for that (were they removed?):
|
@xedin I believe you want to be looking at |
`isDeclAsSpecializedAs` is doing the right thing here, and the code is actually truly ambiguous due to the conditional conformance of `Dictionary` to `Equatable`. Neither of the two overloads in the reduced test case is more specialized than the other: func foo<T: Equatable>(actual: T, expected: T) {}
func foo<K: Equatable, T: NSObjectProtocol>(actual: [K: T], expected: [K: T]) {} because `NSObjectProtocol` is not `Equatable`. The backward- and forward-compatible fix here is to replace `NSObjectProtocol` with `NSObject`; once Swift 4.1 comes with its conditional conformances, the second overload can be removed entirely. |
Is this still an issue? |
Comment by Nicole Jacque (JIRA) @swift-ci create |
Still seeing it in 4.1: But not master: |
@DougGregor/@xedin Does this issue require a project change? |
@lplarson It seems to me that it would be required yes, but @DougGregor is a better person to reply to that... |
Reached out to project maintainer requesting a hash update containing a fix. |
Comment by Krzysztof Zabłocki (JIRA) Should be fixed on Master, via commit: 3041ba7ed84138f13e7973d34973dce2b10259be |
merowing (JIRA User), thanks! Please open a PR on the swift-source-compat-suite projects.json file updating the project hash. |
Hash update PR merged. |
Additional Detail from JIRA
md5: a7a0e42ecf3510a78ad35bf7c54853b1
relates to:
Issue Description:
To reproduce:
To build Swift from scratch before testing:
4. $ ./reproduce.py master --project-path Sourcery --assertions
Or if you've already built Swift:
4. $ ./reproduce.py master --project-path Sourcery --assertions --swiftc path/to/swiftc
https://ci.swift.org/job/swift-PR-source-compat-suite-test-macOS/60/artifact/swift-source-compat-suite/FAIL_BuildSwiftPackage_Sourcery.log
The text was updated successfully, but these errors were encountered: