Rename basicpy_None_type to basicpy_NoneType to match native spelling.

* Also adds Basicpy.py to tests.
pull/1/head
Stella Laurenzo 2020-05-06 19:07:50 -07:00
parent 644d9fb0d3
commit 680e11ae62
3 changed files with 8 additions and 7 deletions

View File

@ -17,25 +17,25 @@ class DialectHelper(_BaseDialectHelper):
>>> h = DialectHelper(c) >>> h = DialectHelper(c)
Dialect Types: Dialect Types:
>>> h.basicpy_None_type >>> h.basicpy_NoneType
!basicpy.NoneType !basicpy.NoneType
>>> h.basicpy_Ellipsis_type >>> h.basicpy_EllipsisType
!basicpy.EllipsisType !basicpy.EllipsisType
>>> h.basicpy_SlotObject_type( >>> h.basicpy_SlotObject_type(
... "foobar", h.basicpy_None_type, h.basicpy_None_type) ... "foobar", h.basicpy_NoneType, h.basicpy_NoneType)
!basicpy.SlotObject<foobar, !basicpy.NoneType, !basicpy.NoneType> !basicpy.SlotObject<foobar, !basicpy.NoneType, !basicpy.NoneType>
singleton op: singleton op:
>>> m = c.new_module() >>> m = c.new_module()
>>> h.builder.insert_block_start(m.first_block) >>> h.builder.insert_block_start(m.first_block)
>>> _ = h.basicpy_singleton_op(h.basicpy_None_type) >>> _ = h.basicpy_singleton_op(h.basicpy_NoneType)
>>> m.to_asm().strip() >>> m.to_asm().strip()
'module {\n %0 = basicpy.singleton : !basicpy.NoneType\n}' 'module {\n %0 = basicpy.singleton : !basicpy.NoneType\n}'
slot_object ops: slot_object ops:
>>> m = c.new_module() >>> m = c.new_module()
>>> h.builder.insert_block_start(m.first_block) >>> h.builder.insert_block_start(m.first_block)
>>> v0 = h.basicpy_singleton_op(h.basicpy_None_type).result >>> v0 = h.basicpy_singleton_op(h.basicpy_NoneType).result
>>> slot_object = h.basicpy_slot_object_make_op("foobar", v0, v0).result >>> slot_object = h.basicpy_slot_object_make_op("foobar", v0, v0).result
>>> _ = h.basicpy_slot_object_get_op(slot_object, 0) >>> _ = h.basicpy_slot_object_get_op(slot_object, 0)
>>> print(m.to_asm().strip()) >>> print(m.to_asm().strip())

View File

@ -21,12 +21,12 @@ public:
static void bind(py::module m) { static void bind(py::module m) {
py::class_<BasicpyDialectHelper, PyDialectHelper>(m, "BasicpyDialectHelper") py::class_<BasicpyDialectHelper, PyDialectHelper>(m, "BasicpyDialectHelper")
.def(py::init<std::shared_ptr<PyContext>>()) .def(py::init<std::shared_ptr<PyContext>>())
.def_property_readonly("basicpy_None_type", .def_property_readonly("basicpy_NoneType",
[](BasicpyDialectHelper &self) -> PyType { [](BasicpyDialectHelper &self) -> PyType {
return Basicpy::NoneType::get( return Basicpy::NoneType::get(
&self.context->context); &self.context->context);
}) })
.def_property_readonly("basicpy_Ellipsis_type", .def_property_readonly("basicpy_EllipsisType",
[](BasicpyDialectHelper &self) -> PyType { [](BasicpyDialectHelper &self) -> PyType {
return Basicpy::EllipsisType::get( return Basicpy::EllipsisType::get(
&self.context->context); &self.context->context);

View File

@ -7,6 +7,7 @@ import sys
TEST_MODULES = ( TEST_MODULES = (
"npcomp.mlir_ir_test", "npcomp.mlir_ir_test",
"npcomp.dialect.Basicpy",
"npcomp.dialect.Numpy", "npcomp.dialect.Numpy",
"npcomp.tracing.context", "npcomp.tracing.context",
"npcomp.tracing.mlir_trace", "npcomp.tracing.mlir_trace",