From 5a308ddc7547e3bd7c1c0e2833b17394a276a747 Mon Sep 17 00:00:00 2001 From: youben11 Date: Fri, 8 Oct 2021 13:57:51 +0100 Subject: [PATCH] fix(python): add missing import Also added a test to catch future similar failure. Mainly, we didn't have tests that imported and used the HLFHE dialect from the python bindings --- .../Bindings/Python/zamalang/dialects/_ods_common.py | 2 +- compiler/tests/python/test_hlfhe_dialect.py | 10 ++++++++++ 2 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 compiler/tests/python/test_hlfhe_dialect.py diff --git a/compiler/lib/Bindings/Python/zamalang/dialects/_ods_common.py b/compiler/lib/Bindings/Python/zamalang/dialects/_ods_common.py index 2682f6bf5..da79c9e14 100644 --- a/compiler/lib/Bindings/Python/zamalang/dialects/_ods_common.py +++ b/compiler/lib/Bindings/Python/zamalang/dialects/_ods_common.py @@ -1,2 +1,2 @@ # We need this helpers from the mlir bindings, they are used in the generated files -from mlir.dialects._ods_common import _cext, segmented_accessor, equally_sized_accessor, extend_opview_class, get_default_loc_context +from mlir.dialects._ods_common import _cext, segmented_accessor, equally_sized_accessor, extend_opview_class, get_default_loc_context, get_op_result_or_value, get_op_results_or_values diff --git a/compiler/tests/python/test_hlfhe_dialect.py b/compiler/tests/python/test_hlfhe_dialect.py new file mode 100644 index 000000000..a95e6265b --- /dev/null +++ b/compiler/tests/python/test_hlfhe_dialect.py @@ -0,0 +1,10 @@ +from mlir.ir import Context +from zamalang import register_dialects +from zamalang.dialects import hlfhe + + +def test_eint(): + ctx = Context() + register_dialects(ctx) + eint = hlfhe.EncryptedIntegerType.get(ctx, 6) + assert eint.__str__() == "!HLFHE.eint<6>"