Skip to content

Commit d6648ff

Browse files
Extend tests that applies new constraint non-StringAttr attribute.
Signed-off-by: Ingo Müller <[email protected]>
1 parent 902cc53 commit d6648ff

File tree

2 files changed

+19
-1
lines changed

2 files changed

+19
-1
lines changed

mlir/test/IR/attribute.mlir

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,17 @@ func.func @string_attr_custom_type_invalid() {
433433

434434
// -----
435435

436+
// CHECK-LABEL: func @string_attr_custom_mixed_type
437+
func.func @string_attr_custom_mixed_type() {
438+
// CHECK: "string_data" : i64
439+
test.string_attr_with_mixed_type "string_data" : i64
440+
// CHECK: 42 : i64
441+
test.string_attr_with_mixed_type 42 : i64
442+
return
443+
}
444+
445+
// -----
446+
436447
//===----------------------------------------------------------------------===//
437448
// Test I32EnumAttr
438449
//===----------------------------------------------------------------------===//

mlir/test/lib/Dialect/Test/TestOps.td

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,11 +193,18 @@ def TypeArrayAttrWithDefaultOp : TEST_Op<"type_array_attr_with_default"> {
193193
let arguments = (ins DefaultValuedAttr<TypeArrayAttr, "{}">:$attr);
194194
}
195195

196-
def TypeStringAttrWithTypeOp : TEST_Op<"string_attr_with_type"> {
196+
def TypedStringAttrWithTypeOp : TEST_Op<"string_attr_with_type"> {
197197
let arguments = (ins TypedStrAttr<AnyInteger>:$attr);
198198
let assemblyFormat = "$attr attr-dict";
199199
}
200200

201+
def TypedStringAttrWithMixedTypeOp : TEST_Op<"string_attr_with_mixed_type"> {
202+
let arguments = (ins
203+
AnyAttrOf<[TypedStrAttr<AnyInteger>, I64Attr]>:$attr
204+
);
205+
let assemblyFormat = "$attr attr-dict";
206+
}
207+
201208
def FloatAttrOp : TEST_Op<"float_attrs"> {
202209
// TODO: Clean up the OpBase float type and attribute selectors so they
203210
// can express all of the types.

0 commit comments

Comments
 (0)