Skip to content
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

Skylark should validate that only one instance of a provider is being returned by the rule #5709

Closed
c-parsons opened this issue Jul 30, 2018 · 3 comments
Assignees

Comments

@c-parsons
Copy link
Contributor

I received some complaints from a user that there's some very confusing behavior surrounding returned providers from a Skylark rule implementation.
Namely, if a rule implementation returns multiple providers of the same type, i.e.

MyProvider = provider()

def my_rule_impl(ctx):
   return struct(providers = [MyProvider(x = "foo"), MyProvider(x = " bar")])

that the last such provider is the only one propagated, and each other provider is silently dropped.

This reportedly led to about a day of lost work for this user, so this is likely a pattern we should error against.

@laurentlb
Copy link
Contributor

The current behavior is obviously buggy. We should throw an error instead.

Since it's a breaking change, we should use a --incompatible flag. This will allow users to check their code and fix it, before we make it a hard error in Bazel.

@laurentlb
Copy link
Contributor

Did you fix it?

@c-parsons
Copy link
Contributor Author

Indeed. I must have lost track of this particular issue, as I filed a duplicate #5902 and tracked this fix there. Oops!
I want to leave that bug open to track the migration to the new flag. So perhaps we can close this?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants