Skip to content

struct allows adding two structs with overlapping fields, unlike Bazel #582

@oprypin

Description

@oprypin

Example:

print(struct(foo = "bar") + struct(foo = "bar"))

Result in Bazel:

Error: cannot add struct instances with common field 'foo'

Result in starlark-go:

struct(foo = "bar")

Let me know if it is expected for this struct type from starlarkstruct to roughly match Bazel at all, or if this report is invalid.

As far as I'm aware, there's no reasonable workaround for this: to change this behavior, one would need to entirely replace the struct type with their own copy.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions