1 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR1 %s 2>&1 | FileCheck --check-prefix=ERROR1 %s
2 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR2 %s 2>&1 | FileCheck --check-prefix=ERROR2 %s
3 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR3 %s 2>&1 | FileCheck --check-prefix=ERROR3 %s
4 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR4 %s 2>&1 | FileCheck --check-prefix=ERROR4 %s
5 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR5 %s 2>&1 | FileCheck --check-prefix=ERROR5 %s
6 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR6 %s 2>&1 | FileCheck --check-prefix=ERROR6 %s
7 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR7 %s 2>&1 | FileCheck --check-prefix=ERROR7 %s
8 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR8 %s 2>&1 | FileCheck --check-prefix=ERROR8 %s
9 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR9 %s 2>&1 | FileCheck --check-prefix=ERROR9 %s
10 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR10 %s 2>&1 | FileCheck --check-prefix=ERROR10 %s
11 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR11 %s 2>&1 | FileCheck --check-prefix=ERROR11 %s
12 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR12 %s 2>&1 | FileCheck --check-prefix=ERROR12 %s
13 // RUN: not mlir-tblgen -gen-op-decls -I %S/../../include -DERROR13 %s 2>&1 | FileCheck --check-prefix=ERROR13 %s
15 include "mlir/IR/OpBase.td"
17 def Test_Dialect : Dialect {
18 let name = "test_dialect";
22 // ERROR1: error: expected 'ins'
23 def OpInsMissing : Op<Test_Dialect, "ins_missing"> {
31 // ERROR2: error: expected an argument with default value after other arguments with default values
32 def OpDefaultValueNotTrailing : Op<Test_Dialect, "default_value"> {
34 OpBuilder<(ins CArg<"int", "42">, "int")>
40 // ERROR3: error: expected an argument with default value after other arguments with default values
41 def OpDefaultValueNotTrailing : Op<Test_Dialect, "default_value"> {
43 OpBuilder<(ins CArg<"int", "42">, CArg<"int">)>
49 // ERROR4: error: op has a conflict with two operands having the same name 'tensor'
50 def OpWithDuplicatedArgNames : Op<Test_Dialect, "default_value"> {
51 let arguments = (ins AnyTensor:$tensor, AnyTensor:$tensor);
56 // ERROR5: error: op has a conflict with two results having the same name 'tensor'
57 def OpWithDuplicatedResultNames : Op<Test_Dialect, "default_value"> {
58 let results = (outs AnyTensor:$tensor, AnyTensor:$tensor);
63 // ERROR6: error: op has a conflict with operands and results both having an entry with the name 'tensor'
64 def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
65 let arguments = (ins AnyTensor:$tensor);
66 let results = (outs AnyTensor:$tensor);
71 // ERROR7: error: op has a conflict with operands and regions both having an entry with the name 'tensor'
72 def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
73 let arguments = (ins AnyTensor:$tensor);
74 let regions = (region AnyRegion:$tensor);
79 // ERROR8: error: op has a conflict with results and regions both having an entry with the name 'tensor'
80 def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
81 let results = (outs AnyTensor:$tensor);
82 let regions = (region AnyRegion:$tensor);
87 // ERROR9: error: op has a conflict with operands and successors both having an entry with the name 'target'
88 def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
89 let successors = (successor AnySuccessor:$target);
90 let arguments = (ins AnyTensor:$target);
95 // ERROR10: error: op has a conflict with results and successors both having an entry with the name 'target'
96 def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
97 let successors = (successor AnySuccessor:$target);
98 let results = (outs AnyTensor:$target);
103 // ERROR11: error: op has a conflict with regions and successors both having an entry with the name 'target'
104 def OpWithDuplicatedArgResultNames : Op<Test_Dialect, "default_value"> {
105 let successors = (successor AnySuccessor:$target);
106 let regions = (region AnyRegion:$target);
111 def OpTraitA : NativeOpTrait<"OpTraitA"> {}
112 def OpTraitB : NativeOpTrait<"OpTraitB", [OpTraitA]> {}
114 // ERROR12: error: OpTraitB requires OpTraitA to precede it in traits list
115 def OpTraitWithoutDependentTrait : Op<Test_Dialect, "default_value", [OpTraitB]> {}
119 def OpTraitA : NativeOpTrait<"OpTraitA"> {}
120 def OpInterfaceB : OpInterface<"OpInterfaceB"> {
121 let dependentTraits = [OpTraitA];
124 // ERROR13: error: OpInterfaceB::Trait requires OpTraitA to precede it in traits list
125 def OpInterfaceWithoutDependentTrait : Op<Test_Dialect, "default_value", [OpInterfaceB]> {}