-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
find a way to permit impls of CommonTypeWith where the LHS and RHS type overlap #1077
Comments
I don't think
I think if we wanted to go in either of these two directions, I'd rather a
I'm not excited about this, since we currently don't have a way of proving that two types are not equal.
I'd be fine with this option. It only resolves a relatively narrow set of cases similar to the |
While I agree, this also specifically addresses the only downside to making the What if we start here to see whether this ends up covering the cases where this is an issue? We can always revisit prioritizing the final in all cases if further use cases emerge. |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the |
We triage inactive PRs and issues in order to make it easier to find active work. If this issue should remain active or becomes active again, please comment or remove the |
As far as I am aware, we would still like an answer to this question. An answer was proposed in #1077 (comment) but never accepted. |
Yep, leads are happy with the resolution here: #1077 (comment) |
Allow an `impl` to overlap with a `final impl` if they agree on the overlap. Agreement is defined as all values comparing equal, and functions never comparing equal. Implements the decision in question-for-leads issue #1077.
Per the current design,
CommonTypeWith
has animpl
of this form:Given this
final impl
, it's unclear how to write a parameterizedimpl
ofCommonTypeWith
for two parameterized types that overlap. For example:The error here is unnecessary: there's no actual coherence problem here because in the case where
T == U
, the computedResult
isVec(T)
.It's not clear how to resolve this. Some options:
final impl
to a final associated constant.impl
to say that it's prioritized below thefinal impl
.final impl
to say that it is considered more specialized than any otherimpl
, rather than disallowingimpl
s that overlap with it.impl
could exclude theT == U
case.final impl
to be specialized if the specialization is identical.The text was updated successfully, but these errors were encountered: