1 // RUN: mlir-tblgen -gen-op-defs -I %S/../../include %s | FileCheck %s
3 include "mlir/IR/OpBase.td"
5 def Test_Dialect : Dialect {
9 def TopLevelTypeInterface : TypeInterface<"TopLevelTypeInterface">;
11 def TypeInterfaceInNamespace : TypeInterface<"TypeInterfaceInNamespace"> {
12 let cppNamespace = "test";
15 def TopLevelAttrInterface : AttrInterface<"TopLevelAttrInterface">;
17 def AttrInterfaceInNamespace : AttrInterface<"AttrInterfaceInNamespace"> {
18 let cppNamespace = "test";
21 def OpUsingAllOfThose : Op<Test_Dialect, "OpUsingAllOfThose"> {
22 let arguments = (ins TopLevelAttrInterface:$attr1, AttrInterfaceInNamespace:$attr2);
23 let results = (outs TopLevelTypeInterface:$res1, TypeInterfaceInNamespace:$res2);
26 // CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
27 // CHECK: if (!((type.isa<TopLevelTypeInterface>()))) {
28 // CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
29 // CHECK-NEXT: << " must be TopLevelTypeInterface instance, but got " << type;
31 // CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
32 // CHECK: if (!((type.isa<test::TypeInterfaceInNamespace>()))) {
33 // CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
34 // CHECK-NEXT: << " must be TypeInterfaceInNamespace instance, but got " << type;
36 // CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
37 // CHECK: if (attr && !((attr.isa<TopLevelAttrInterface>()))) {
38 // CHECK-NEXT: return op->emitOpError("attribute '") << attrName
39 // CHECK-NEXT: << "' failed to satisfy constraint: TopLevelAttrInterface instance";
41 // CHECK: static ::mlir::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
42 // CHECK: if (attr && !((attr.isa<test::AttrInterfaceInNamespace>()))) {
43 // CHECK-NEXT: return op->emitOpError("attribute '") << attrName
44 // CHECK-NEXT: << "' failed to satisfy constraint: AttrInterfaceInNamespace instance";
46 // CHECK: TopLevelAttrInterface OpUsingAllOfThose::getAttr1()
47 // CHECK: test::AttrInterfaceInNamespace OpUsingAllOfThose::getAttr2()