Mehdi Amini b9356b047e
[mlir][test] Reject TestWithBoundsOp with mismatched attribute width in verifier (#184093)
Add a verifier to `TestWithBoundsOp` that rejects bounds attributes
whose
bit width does not match the result type's storage width (e.g., `10 :
i64`
for an `i8` result). This makes the mismatch invalid IR rather than
silently
accepting it, preventing downstream crashes in consumers such as
`TestReflectBoundsOp::inferResultRanges` that assert on matching widths.

`inferResultRanges` is reverted to its original one-liner; the new
`verify()` method enforces the invariant at IR construction time.

A dedicated test file (`infer-int-range-test-ops-invalid.mlir`) uses
`-verify-diagnostics` to check the emitted error message.

Fixes #120882

Assisted-by: Claude Code
2026-03-06 16:44:56 +01:00
..