-
-
Notifications
You must be signed in to change notification settings - Fork 652
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
Allow explicit dependencies to resolve ambiguities #20853
base: main
Are you sure you want to change the base?
Conversation
out.add(addr) | ||
maybe_tgt_generator = addr.maybe_convert_to_target_generator() | ||
if maybe_tgt_generator in self.includes: | ||
# TODO: do we include the maybe_tgt_generator or the addr? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm honestly not sure about this. I should also probably add a test to pin down the desired behaviour
(Thanks for looking at this, given #20806 affects 2.20.0, I've pre-emptively labelled this for cherry-picking back to that branch.) |
What's the status on this? |
I think we said that this wasn't the right approach. In the slack thread we determined that we'd probably want to just give more/better warnings. The summary of the reasoning is that it's intentional that explicit deps function as overrides. So dep inference should not attempt resolution, and should instead defer to the explicit deps |
In case of an ambiguous dependency inference, we give the help text:
However, adding an explicit dependency doesn't actually resolve that.
In ExplicitlyProvidedDependencies.disambiguated, if the target is in the explicitly provided dependencies, we just return. This results in the dependency being unowned, but included because of the explicit dependency link.
This MR rebuilds that function to use the explicitly provided dependencies to attempt to resolve an ambiguity. The logic is now as follows:
This algorithm change does result in changes to dependency inference. We can now resolve a situation which had both includes and excludes, and the excludes would resolve it. Previously, this would not be resolved.
I don't think this will result in other changes in resolution. (I considered the case of the same address being included and excluded, but it seems that the excludes currently functionally take priority).
fixes #20806