-
Notifications
You must be signed in to change notification settings - Fork 4k
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
WORKSPACE files allow shadowing loads #17480
Comments
illicitonion
added a commit
to illicitonion/buildtools
that referenced
this issue
Feb 13, 2023
WORKSPACE files currently allow shadowing loads (see bazelbuild/bazel#17480), i.e. the following is valid: ```starlark load("//:one.bzl", "fn") fn() load("//:two.bzl", "fn") fn() ``` Currently buildozer removes the second load because the symbol was already loaded. This is incorrect - removing the second load changes the behaviour of this file. Instead, only delete a load of the last time it was loaded was from the same place.
At this point it's very unlikely that we'll spend any energy fixing WORKSPACE bugs; all cycles are devoted to Bzlmod instead. So I'll go ahead and close this, even though it's a very valid bug report. |
vladmos
pushed a commit
to bazelbuild/buildtools
that referenced
this issue
Mar 2, 2023
WORKSPACE files currently allow shadowing loads (see bazelbuild/bazel#17480), i.e. the following is valid: ```starlark load("//:one.bzl", "fn") fn() load("//:two.bzl", "fn") fn() ``` Currently buildozer removes the second load because the symbol was already loaded. This is incorrect - removing the second load changes the behaviour of this file. Instead, only delete a load of the last time it was loaded was from the same place.
apattidb
pushed a commit
to databricks/buildtools
that referenced
this issue
May 10, 2024
WORKSPACE files currently allow shadowing loads (see bazelbuild/bazel#17480), i.e. the following is valid: ```starlark load("//:one.bzl", "fn") fn() load("//:two.bzl", "fn") fn() ``` Currently buildozer removes the second load because the symbol was already loaded. This is incorrect - removing the second load changes the behaviour of this file. Instead, only delete a load of the last time it was loaded was from the same place.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Description of the bug:
This is a valid WORKSPACE file:
The second
fn
binding shadows the first one.This is confusing, and error-prone. I would argue that this should be rejected by Bazel, requiring one of the loads to be renamed.
What's the simplest, easiest way to reproduce this bug? Please provide a minimal example if possible.
Which operating system are you running Bazel on?
No response
What is the output of
bazel info release
?release 6.0.0
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse master; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: