Files
Mehdi Amini 691c653213 [mlir][tblgen] Emit diagnostic instead of crashing for invalid interface method arg type (#186430)
When an interface method argument uses a non-string type (e.g., a
TableGen class reference like `Foo` instead of a string literal
`"Foo"`), the code in `InterfaceMethod::InterfaceMethod` would crash
with an assertion failure in `cast<StringInit>`. Replace the unchecked
cast with a `dyn_cast` and emit a `PrintFatalError` with a descriptive
error message pointing to the source location and identifying which
argument has the wrong type.

Before this fix:
mlir-tblgen: Assertion `isa<To>(Val) && "cast<Ty>() argument of
incompatible type\!"' failed.

After this fix:
error: expected string type for interface method argument #0 ('arg') ...

Fixes #61869

Assisted-by: Claude Code
2026-03-23 13:51:36 +01:00
..