Skip to content

uquery 'intersect' and 'except' do not accept any value #1109

@hdgarrood

Description

@hdgarrood

The docs hosted at https://buck2.build/docs/users/query/uquery/ state that intersect and except accept any value, but they appear to only work with target sets. For example, using the structure produced by buck2 init --git, with the following BUCK file:

# A list of available rules and their signatures can be found here: https://buck2.build/docs/prelude/globals/

genrule(
    name = "hello_world",
    out = "out.txt",
    cmd = "echo BUILT BY BUCK2> $OUT",
)
$ buck2 --version
buck2 2025-05-06-201beb86106fecdc84e30260b0f1abb5bf576988
$ buck2 uquery 'inputs(//:hello_world) intersect inputs(//:hello_world)'
Error evaluating expression:
    inputs(//:hello_world) intersect inputs(//:hello_world)
    ^-----------------------------------------------------^


Caused by:
    expected value of type `target_set`, got `FileSet`:
        inputs(//:hello_world) intersect inputs(//:hello_world)
                                         ^--------------------^
    
Build ID: d0276bfb-b46c-402c-a91b-8d82877ad5db
Command: query.                                                                                                                     
Time elapsed: 0.0s

I get the same result with except, but curiously union does work. I get the same behaviour with cquery as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions