[Mlir-commits] [mlir] [mlir][Parser] Fix crash after block parsing failure (PR #128011)
Matthias Springer
llvmlistbot at llvm.org
Fri Feb 21 00:36:55 PST 2025
================
@@ -675,3 +675,17 @@ func.func @error_at_end_of_line() {
// -----
@foo // expected-error {{expected operation name in quotes}}
+
+// -----
+
+func.func @drop_references_on_block_parse_error(){
+ "test.user"(%i, %1) : (index, index) -> ()
+ "test.op_with_region"() ({
+ ^bb0(%i : index):
+ // expected-error @below{{expected operation name in quotes}}
----------------
matthias-springer wrote:
I think this is the reason:
```mlir
// This makes sure we emit an error at the end of the correct line, the : is
// expected at the end of foo, not on the return line.
func.func @error_at_end_of_line() {
%0 = "foo"()
// expected-error at -1 {{expected ':' followed by operation type}}
// This is a comment and so is the thing above.
return
}
```
Here, it's better to report the error at the end of the line. In this example test case that I posted, the other way around would have been better...
https://github.com/llvm/llvm-project/pull/128011
More information about the Mlir-commits
mailing list