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 ::llvm::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
27 // CHECK: if (!((::llvm::isa<TopLevelTypeInterface>(type)))) {
28 // CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
29 // CHECK-NEXT: << " must be TopLevelTypeInterface instance, but got " << type;
31 // CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_type_constraint.*}}(
32 // CHECK: if (!((::llvm::isa<test::TypeInterfaceInNamespace>(type)))) {
33 // CHECK-NEXT: return op->emitOpError(valueKind) << " #" << valueIndex
34 // CHECK-NEXT: << " must be TypeInterfaceInNamespace instance, but got " << type;
36 // CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
37 // CHECK: if (attr && !((::llvm::isa<TopLevelAttrInterface>(attr))))
38 // CHECK-NEXT: return emitError() << "attribute '" << attrName
39 // CHECK-NEXT: << "' failed to satisfy constraint: TopLevelAttrInterface instance";
41 // CHECK: static ::llvm::LogicalResult {{__mlir_ods_local_attr_constraint.*}}(
42 // CHECK: if (attr && !((::llvm::isa<test::AttrInterfaceInNamespace>(attr))))
43 // CHECK-NEXT: return emitError() << "attribute '" << attrName
44 // CHECK-NEXT: << "' failed to satisfy constraint: AttrInterfaceInNamespace instance";
46 // CHECK: TopLevelAttrInterface OpUsingAllOfThose::getAttr1()
47 // CHECK: test::AttrInterfaceInNamespace OpUsingAllOfThose::getAttr2()