[Mlir-commits] [mlir] [MLIR][Python] Make traits declarative in python-defined operations (PR #180748)

Rolf Morel llvmlistbot at llvm.org
Wed Feb 11 03:27:38 PST 2026


================
@@ -225,6 +227,14 @@ def __init_subclass__(cls, *, name: str = None, **kwargs):
 
         cls._fields = fields
 
+        traits = traits or []
+
+        for base in cls.__bases__:
+            if hasattr(base, "_traits"):
+                traits = base._traits + traits
+
+        cls._traits = traits
----------------
rolfmorel wrote:

Maybe it should be a `@property` though, to make it read only.

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


More information about the Mlir-commits mailing list