[Mlir-commits] [mlir] [mlir] Fix copy paste typo in convertFromAttribute (PR #192484)
llvmlistbot at llvm.org
llvmlistbot at llvm.org
Thu Apr 16 21:55:25 PDT 2026
https://github.com/janssen-v updated https://github.com/llvm/llvm-project/pull/192484
>From 4b018f8f52950e56da1c8c6c7034d6da41a34e4f Mon Sep 17 00:00:00 2001
From: Vincentius Janssen <janssen.vincentius at gmail.com>
Date: Fri, 17 Apr 2026 03:45:01 +0000
Subject: [PATCH] [mlir] Fix copy paste typo in convertFromAttribute
---
mlir/lib/IR/ODSSupport.cpp | 3 +-
mlir/test/IR/invalid-properties.mlir | 49 ++++++++++++++++++++++++++++
2 files changed, 50 insertions(+), 2 deletions(-)
create mode 100644 mlir/test/IR/invalid-properties.mlir
diff --git a/mlir/lib/IR/ODSSupport.cpp b/mlir/lib/IR/ODSSupport.cpp
index f2665d24efda6..de6139da84f1f 100644
--- a/mlir/lib/IR/ODSSupport.cpp
+++ b/mlir/lib/IR/ODSSupport.cpp
@@ -102,8 +102,7 @@ mlir::convertFromAttribute(bool &storage, Attribute attr,
function_ref<InFlightDiagnostic()> emitError) {
auto valueAttr = dyn_cast<BoolAttr>(attr);
if (!valueAttr)
- return emitError()
- << "expected string property to come from string attribute";
+ return emitError() << "expected BoolAttr for key `value`";
storage = valueAttr.getValue();
return success();
}
diff --git a/mlir/test/IR/invalid-properties.mlir b/mlir/test/IR/invalid-properties.mlir
new file mode 100644
index 0000000000000..4c9cdc3b1a692
--- /dev/null
+++ b/mlir/test/IR/invalid-properties.mlir
@@ -0,0 +1,49 @@
+// RUN: mlir-opt -verify-diagnostics -split-input-file %s
+
+
+// -----
+
+func.func @wrong_string_prop_type() {
+ // expected-error at +1 {{expected string property to come from string attribute}}
+ "test.with_properties"() <{b = "foo", c = 32 : i64}> : () -> ()
+ return
+}
+
+// -----
+
+func.func @wrong_bool_prop_type() {
+ // expected-error at +1 {{expected BoolAttr for key `value`}}
+ "test.with_properties"() <{b = "foo", flag = "bar"}> : () -> ()
+ return
+}
+
+// -----
+
+func.func @wrong_integer_prop_type() {
+ // expected-error at +1 {{expected IntegerAttr for key `value`}}
+ "test.with_properties"() <{b = "foo", a = "bar"}> : () -> ()
+ return
+}
+
+// -----
+
+func.func @wrong_dense_i64_array_prop_type() {
+ // expected-error at +1 {{expected DenseI64ArrayAttr for key `value`}}
+ "test.with_properties"() <{b = "foo", array = array<i32: 1, 2, 3, 4>}> : () -> ()
+ return
+}
+
+// -----
+
+func.func @wrong_dense_i32_array_prop_type() {
+ // expected-error at +1 {{expected DenseI32ArrayAttr for key `value`}}
+ "test.with_properties"() <{b = "foo", array32 = array<i64: 5, 6>}> : () -> ()
+ return
+}
+
+// -----
+
+func.func @valid_all_properties() {
+ "test.with_properties"() <{a = 32 : i64, array = array<i64: 1, 2, 3, 4>, array32 = array<i32: 5, 6>, b = "foo", c = "bar", flag = true}> : () -> ()
+ return
+}
More information about the Mlir-commits
mailing list