Error ambiguous use of 'selector' with unknown candidate

I'm getting an error in our Test target after migrating to swift 3:


error: ambiguous use of 'init(sectionIndex:itemIndex:)'
      ItemPath(sectionIndex: 0, itemIndex: 0),
      ^
RxDataSources.ItemPath:4:12: note: found this candidate
    public init(sectionIndex: Int, itemIndex: Int)
           ^
<unknown>:0: note: found this candidate


The use of ItemPath in the main target works fine so it is pretty odd and the unknown second candidate doesn't help solving this.


A similar issue happens with an operator we've declared and used throughout the main target but generates the same "ambiguous" issue in the test target only this time all 2 candidates are unknown...


Has anyone encountered a similar issue ? And found a solution ?


Thanks !

Replies

Have you tried this with the current Xcode 8.3 beta? It’d be interesting to see if that does a better job of telling you what’s wrong.

If the problem reproduces there, it’d be helpful if you could file a bug about this. Even if this turns out to be a problem with your code, the poor diagnostics could stand some improvement. It’d be most helpful if you include a project that reproduces the failure.

Please post your bug number, just for the record.

As to your actual problem, how is you test target set up? Are you building a framework and testing that? Linking the code directly into your test target? Or having your test target run the code out of your app?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Just tried the 8.3 beta but no luck.

I have filed a bug: 30304301. I'll try to have a sample project reproducing the issue.


The test target is for an iOS app.

I've created a new iOS Unit Testing Bundle target to isolate the failing tests.

The errors remain though.

I've created a new iOS Unit Testing Bundle target to isolate the failing tests. The errors remain though.

OK. Is the code that implements the

ItemPath
type linked into the unit test? Or into the app? Or both?

Is it in one file? Or do you have it spread across multiple files via extensions?

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

ItemPath comes from the RxDataSources project that is linked into the app and is in one file.

However, I found out we had an extension with the exact same init in our app.

Removing that init solved the issue ! Thank you so much.


I still have to figure out the operator being ambiguous as well.

The custom operator was ~>

Changing its precedence solved the compile issue !