bazelbuild / bazelbuild/bazel

selects should not allow their values to be mutated

Open
#30,094 2 comments 0 reactions 0 assignees View on GitHub
P3 team-Loading-API
Dominant language
Java
Stars
25.8k
Forks
4.6k
Avg merge
2d 16h
Merged PRs (30d)
72

Description

The following usage is currently permitted by Bazel, but probably should not be:

```bzl
x = []
s = select({"//foo": ["foo"], "//conditions:default": x})
x.append(123.4)
# s's default value is now non-empty and of an incompatible type
```

At minimum, we should ban it in documentation.

And in the Bazel 10 static type checker, I want to add the simplifying assumption that such usage is illegal.

@brandjon FYI

Contributor guide

Open the contributing guide

Research direction

Start by locating the implementation and documentation for select, then inspect the Bazel 10 static type checker entry point. Confirm how mutations of values passed to select are currently handled and identify the documentation and checker behavior that must agree. Done means the policy is documented and the type-checking assumption is represented consistently.

Written by the indexing model from the issue text.

Assessment

Domain
build-system, tooling
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
48/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.