Skip to content

Commit 2ae4815

Browse files
committed
Add additional test case
1 parent 049bace commit 2ae4815

File tree

1 file changed

+20
-4
lines changed

1 file changed

+20
-4
lines changed

mlir/test/python/dialects/func.py

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -109,11 +109,27 @@ def testFunctionCalls():
109109
# CHECK-LABEL: TEST: testFunctionArgAttrs
110110
@constructAndPrintInModule
111111
def testFunctionArgAttrs():
112-
foo = func.FuncOp("foo", ([("arg0", F32Type.get())], []))
112+
foo = func.FuncOp("foo", ([F32Type.get()], []))
113+
foo.sym_visibility = StringAttr.get("private")
114+
foo2 = func.FuncOp("foo2", ([F32Type.get(), F32Type.get()], []))
115+
foo2.sym_visibility = StringAttr.get("private")
113116

114-
assert len(foo.arg_attrs) == 1
115-
assert foo.arg_attrs[0] == DictAttr.get({})
117+
empty_attr = DictAttr.get({})
118+
test_attr = DictAttr.get({"test.foo": StringAttr.get("bar")})
119+
test_attr2 = DictAttr.get({"test.baz": StringAttr.get("qux")})
116120

117-
foo.arg_attrs = [DictAttr.get({"test.foo": StringAttr.get("bar")})]
121+
assert len(foo.arg_attrs) == 1
122+
assert foo.arg_attrs[0] == empty_attr
118123

124+
foo.arg_attrs = [test_attr]
119125
assert foo.arg_attrs[0]["test.foo"] == StringAttr.get("bar")
126+
127+
assert len(foo2.arg_attrs) == 2
128+
assert foo2.arg_attrs == ArrayAttr.get([empty_attr, empty_attr])
129+
130+
foo2.arg_attrs = [empty_attr, test_attr2]
131+
assert foo2.arg_attrs == ArrayAttr.get([empty_attr, test_attr2])
132+
133+
134+
# CHECK: func private @foo(f32 {test.foo = "bar"})
135+
# CHECK: func private @foo2(f32, f32 {test.baz = "qux"})

0 commit comments

Comments
 (0)