[Mlir-commits] [mlir] [mlir][python] auto attribute casting (PR #97786)
Maksim Levental
llvmlistbot at llvm.org
Fri Jul 5 06:05:24 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))
+
----------------
makslevental wrote:
I did that at first and you get the fairly mysterious `import_lib.bootstrao.TestAttr` which is why I went ahead and added the `repr` implementation.
https://github.com/llvm/llvm-project/pull/97786
More information about the Mlir-commits
mailing list