[Mlir-commits] [mlir] [mlir][python] auto attribute casting (PR #97786)

Bart Chrzaszcz llvmlistbot at llvm.org
Fri Jul 5 02:32:04 PDT 2024


================
@@ -307,11 +307,23 @@ def testOptionalOperandOp():
 # CHECK-LABEL: TEST: testCustomAttribute
 @run
 def testCustomAttribute():
-    with Context() as ctx:
+    with Context() as ctx, Location.unknown():
         a = test.TestAttr.get()
         # CHECK: #python_test.test_attr
         print(a)
 
+        # CHECK: python_test.custom_attributed_op  {
+        # CHECK: #python_test.test_attr
+        # CHECK: }
+        op2 = test.CustomAttributedOp(a)
+        print(f"{op2}")
+
+        # CHECK: #python_test.test_attr
+        print(f"{op2.test_attr}")
+
+        # CHECK: TestAttr(#python_test.test_attr)
+        print(repr(op2.test_attr))
+
----------------
bartchr808 wrote:

What about also checking the type function:

```cpp
# CHECK: TestAttr
print(type(op2.test_attr))
```

https://github.com/llvm/llvm-project/pull/97786


More information about the Mlir-commits mailing list