Skip to content

Add match_none negation to config_setting_group - #634

Open
thii wants to merge 1 commit into
bazelbuild:mainfrom
thii:selects-match-none
Open

Add match_none negation to config_setting_group#634
thii wants to merge 1 commit into
bazelbuild:mainfrom
thii:selects-match-none

Conversation

@thii

@thii thii commented Jul 28, 2026

Copy link
Copy Markdown
Member

config_setting_group can now express negation: settings listed in the
new match_none attribute must not match for the group to match. It can
be combined with match_any or match_all, or used on its own:

selects.config_setting_group(
    name = "opt_but_not_stamped",
    match_all = [":opt"],
    match_none = [":stamped"],
)

Negated settings compile into the existing alias chains: each negated
link resolves to the new //lib:always_false sentinel when its setting
matches and advances otherwise. Since NOT (a OR b) is the same as
(NOT a) AND (NOT b), all combinations reduce to a single AND chain; a
match_any part is compiled into a private "_any" OR group first.
Pure-negation groups end in a dedicated NOT alias.

Resolves #272

config_setting_group can now express negation: settings listed in the
new match_none attribute must not match for the group to match. It can
be combined with match_any or match_all, or used on its own:

    selects.config_setting_group(
        name = "opt_but_not_stamped",
        match_all = [":opt"],
        match_none = [":stamped"],
    )

Negated settings compile into the existing alias chains: each negated
link resolves to the new //lib:always_false sentinel when its setting
matches and advances otherwise. Since NOT (a OR b) is the same as
(NOT a) AND (NOT b), all combinations reduce to a single AND chain; a
match_any part is compiled into a private "<name>_any" OR group first.
Pure-negation groups end in a dedicated NOT alias.
@thii
thii marked this pull request as ready for review July 28, 2026 15:40
@comius
comius removed their request for review July 30, 2026 10:44
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

Successfully merging this pull request may close these issues.

Feature Request: Negative/Not conditionals for selects

1 participant