182 lines · plain
1// RUN: mlir-opt %s -verify-diagnostics -split-input-file2 3// Testing invalid IRDL IRs4 5irdl.dialect @testd {6 irdl.type @type {7 %0 = irdl.any8 // expected-error@+1 {{expected valid keyword}}9 irdl.parameters(%0)10 }11}12 13// -----14 15irdl.dialect @testd {16 irdl.type @type {17 %0 = irdl.any18 // expected-error@+1 {{expected valid keyword}}19 irdl.parameters(123: %0)20 }21}22 23// -----24 25irdl.dialect @testd {26 irdl.type @type {27 %0 = irdl.any28 // expected-error@+1 {{name of parameter #0 must contain only lowercase letters, digits and underscores}}29 irdl.parameters(test$test: %0)30 }31}32 33// -----34 35irdl.dialect @testd {36 irdl.operation @op {37 %0 = irdl.any38 // expected-error@+1 {{name of result #0 must contain only lowercase letters, digits and underscores}}39 irdl.results(test$test: %0)40 }41}42 43// -----44 45irdl.dialect @testd {46 irdl.operation @op {47 %0 = irdl.any48 // expected-error@+1 {{name of operand #0 must contain only lowercase letters, digits and underscores}}49 irdl.operands(test$test: %0)50 }51}52 53// -----54 55irdl.dialect @testd {56 irdl.type @type {57 %0 = irdl.any58 // expected-error@+1 {{name of parameter #2 is a duplicate of the name of parameter #0}}59 irdl.parameters(foo: %0, bar: %0, foo: %0)60 }61}62 63// -----64 65irdl.dialect @testd {66 irdl.operation @op {67 %0 = irdl.any68 // expected-error@+1 {{name of result #2 is a duplicate of the name of result #0}}69 irdl.results(foo: %0, bar: %0, foo: %0)70 }71}72 73// -----74 75irdl.dialect @testd {76 irdl.operation @op {77 %0 = irdl.any78 // expected-error@+1 {{name of operand #2 is a duplicate of the name of operand #0}}79 irdl.operands(foo: %0, bar: %0, foo: %0)80 }81}82 83// -----84 85irdl.dialect @testd {86 // expected-error@+1 {{contains a value named 'foo' for both its operands and results}}87 irdl.operation @op {88 %0 = irdl.any89 irdl.operands(foo: %0)90 irdl.results(foo: %0)91 }92}93 94// -----95 96irdl.dialect @testd {97 // expected-error@+1 {{contains a value named 'bar' for both its regions and results}}98 irdl.operation @op {99 %0 = irdl.any100 %1 = irdl.region101 irdl.regions(bar: %1)102 irdl.results(bar: %0)103 }104}105 106// -----107 108irdl.dialect @testd {109 // expected-error@+1 {{contains a value named 'baz' for both its regions and operands}}110 irdl.operation @op {111 %0 = irdl.any112 %1 = irdl.region113 irdl.regions(baz: %1)114 irdl.operands(baz: %0)115 }116}117 118// -----119 120irdl.dialect @testd {121 // expected-error@+1 {{contains a value named 'baz' for both its regions and results}}122 irdl.operation @op {123 %0 = irdl.any124 %1 = irdl.region125 irdl.regions(baz: %1)126 irdl.operands(qux: %0)127 irdl.results(baz: %0)128 }129}130 131// -----132 133irdl.dialect @testd {134 irdl.type @type {135 // expected-error@+1 {{symbol '@foo' not found}}136 %0 = irdl.base @foo137 irdl.parameters(foo: %0)138 }139}140 141// -----142 143irdl.dialect @testd {144 irdl.type @type {145 // expected-error@+1 {{the base type or attribute name should start with '!' or '#'}}146 %0 = irdl.base "builtin.integer"147 irdl.parameters(foo: %0)148 }149}150 151// -----152 153irdl.dialect @testd {154 irdl.type @type {155 // expected-error@+1 {{the base type or attribute name should start with '!' or '#'}}156 %0 = irdl.base ""157 irdl.parameters(foo: %0)158 }159}160 161// -----162 163irdl.dialect @testd {164 irdl.type @type {165 // expected-error@+1 {{the base type or attribute should be specified by either a name}}166 %0 = irdl.base167 irdl.parameters(foo: %0)168 }169}170 171// -----172 173func.func private @not_a_type_or_attr()174 175irdl.dialect @invalid_parametric {176 irdl.operation @foo {177 // expected-error@+1 {{symbol '@not_a_type_or_attr' does not refer to a type or attribute definition}}178 %param = irdl.parametric @not_a_type_or_attr<>179 irdl.results(foo: %param)180 }181}182