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-6564] Compiler seems to ignore constraint on generic type parameter #49114
Comments
@swift-ci create |
It looks like we quickly retire constraints to test if U.T is Int (because we statically know this from the context), but then when we alternate over the overloads of f() we're not opening the new types and attempting to constraint T by Int for each overload we test. Doug, what's supposed to be happening here? Should we be doing something in the solver, or in ranking, or elsewhere? |
@rudkx we have two overload choices for 'f', the protocol requirement and the two extension members. I think we're picking the solution with the protocol requirement and not the extension members. Since the conformance is unconstrained it dispatches to the unconstrained extension member. |
Per discussion on swift-users, this behaves correcly. Overload resolution chooses the best option it can see from the call site; that may be different for a concrete type vs. a generic type because protocol requirements are considered "better" than protocol extension methods. |
OK |
You should file bugs for language documentation at https://bugreport.apple.com. (Please do!) |
Done: 35989836 |
Environment
Xcode 9.2 using recent toolchain (dev snapshot 2017-12-07)
Additional Detail from JIRA
md5: b59e701f99771c6127ac5fa98073f813
Issue Description:
Compiles successfully only with recent snapshots.
Issue is described in the comments.
The text was updated successfully, but these errors were encountered: