[Mlir-commits] [mlir] [mlir][python] add type wrappers (PR #71218)
Maksim Levental
llvmlistbot at llvm.org
Tue Nov 14 06:48:28 PST 2023
================
@@ -772,3 +773,97 @@ def testCustomTypeTypeCaster():
print(t)
# CHECK: OperationType(!transform.op<"foo.bar">)
print(repr(t))
+
+
+# CHECK-LABEL: TEST: testTypeWrappers
+ at run
+def testTypeWrappers():
+ try:
+ from mlir.types import i32
+ except RuntimeError as e:
+ assert e.args[0].startswith(
+ "An MLIR function requires a Context but none was provided"
+ )
+
+ from mlir.types import vector, tensor
----------------
makslevental wrote:
If we're going for consistentcy I would really prefer to go in the other direction and prevent the compound types from being importable. The reason is as they're spelled now, without the extra `()`, the simple types make very natural type annotations for function:
```
def foo(x: T.i32, y: T.f64):
...
```
https://github.com/llvm/llvm-project/pull/71218
More information about the Mlir-commits
mailing list