Skip to content

Add test cases for validating operator preconditions in const-eval contexts #4694

Description

@BenjaminBrienen

In the spec, evaluating let x = -1.0f * mat2x2f(); is supposed to be different than evaluating let y = mat2x2f(); let x = -1.0f * y;. In the second example, the right side expression is not a const expression, but a runtime expression. In order to catch more edge cases and for the sake of completeness, I propose that there should be test coverage for the first scenario, where the right side is a const expression.

In the specific case that was a bug in naga, evaluating -mat2x2f() did not produce an error, even though a matrix type does not satisfy the precondition of the arithmetic negation operator. This was not caught despite the fact that arithmetic unary operator cts tests are enabled.

gfx-rs/wgpu#10036

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