1 // RUN: not mlir-pdll %s -I %S -I %S/../../../include -split-input-file 2>&1 | FileCheck %s
3 //===----------------------------------------------------------------------===//
5 //===----------------------------------------------------------------------===//
8 // CHECK: expected identifier constraint
15 // CHECK: undefined reference to `bar`
26 // CHECK: invalid reference to `FooPattern`
33 // CHECK: expected `:` after `_` variable
40 // CHECK: expected identifier constraint
46 //===----------------------------------------------------------------------===//
48 //===----------------------------------------------------------------------===//
50 Constraint foo(value: Value);
53 // CHECK: expected `)` after argument list
60 // CHECK: expected a reference to a callable `Constraint` or `Rewrite`, but got: `Op`
70 // CHECK: invalid number of arguments for constraint call; expected 0, but got 1
76 Constraint Foo(arg: Value);
79 // CHECK: unable to convert expression of type `Attr` to the expected type of `Value`
85 //===----------------------------------------------------------------------===//
87 //===----------------------------------------------------------------------===//
90 // CHECK: expected identifier or numeric member name
98 // CHECK: invalid member access `unknown_result` on expression of type `Op`
100 erase root.unknown_result;
106 let tuple = (result1 = value: Value, result2 = value);
108 // CHECK: invalid member access `unknown_result` on expression of type `Tuple<result1: Value, result2: Value>`
109 let tuple2 = (tuple.result1, tuple.unknown_result);
117 let tuple = (result1 = value: Value, result2 = value);
119 // CHECK: invalid member access `2` on expression of type `Tuple<result1: Value, result2: Value>`
120 let tuple2 = (tuple.0, tuple.2);
127 //===----------------------------------------------------------------------===//
129 //===----------------------------------------------------------------------===//
132 // CHECK: unable to convert expression of type `Tuple<>` to the expected type of `ValueRange`
133 // CHECK: Tuple to Range conversion is currently only allowed within a rewrite context
140 // CHECK: unable to convert expression of type `Tuple<Value, Type>` to the expected type of `ValueRange`
141 replace op<>(arg: Value) -> (type: Type) with op<test.op>((arg, type));
146 //===----------------------------------------------------------------------===//
148 //===----------------------------------------------------------------------===//
151 // CHECK: expected `)` after tuple element list
152 let tuple = (value: Value, value;
158 // CHECK: unable to build a tuple with `Tuple<Value, Value>` element
159 let tuple = (_: Value, _: Value);
169 // CHECK: unable to build a tuple with `Constraint` element
176 Constraint Foo(op: Op) {}
179 // CHECK: unable to negate non native constraints
189 // CHECK: unable to build a tuple with `Rewrite` element
199 // CHECK: unable to negate a Rewrite
209 // CHECK: expected native constraint
217 let tuple = (attr<"3 : i34">);
218 // CHECK: expected `(` after function name
226 // CHECK: expected expression
227 let tuple = (10 = _: Value);
234 // CHECK: duplicate tuple element label `field`
235 // CHECK: see previous label use here
236 let tuple = (field = _: Value, field = _: Value);
242 //===----------------------------------------------------------------------===//
244 //===----------------------------------------------------------------------===//
247 // CHECK: expected string literal containing MLIR attribute
254 // CHECK: expected `>` after attribute literal
260 //===----------------------------------------------------------------------===//
262 //===----------------------------------------------------------------------===//
265 // CHECK: expected `)` after operation operand list
267 let foo = op<func.func>(value<;
273 // CHECK: unable to convert expression of type `Attr` to the expected type of `ValueRange`
275 let foo = op<func.func>(attr);
281 // CHECK: expected `Value` or `ValueRange` convertible expression, but got `Type`
282 let foo = op<>(_: Type, _: TypeRange);
288 // CHECK: expected identifier or string attribute name
295 // CHECK: expected `Attr` expression, but got `Value`
296 let foo = op<> { foo = _: Value };
302 // CHECK: expected `}` after operation attribute list
303 let foo = op<> { "foo" {;
309 // CHECK: expected `(` before operation result type list
316 // CHECK: unable to convert expression of type `ValueRange` to the expected type of `TypeRange`
317 let foo = op<> -> (_: ValueRange);
323 // CHECK: expected `Type` or `TypeRange` convertible expression, but got `Value`
324 let foo = op<> -> (_: Value, _: ValueRange);
330 // CHECK: expected `)` after operation result type list
331 let value: TypeRange;
332 let foo = op<> -> (value<;
337 #include "include/ops.td"
340 // CHECK: invalid number of operand groups for `test.all_empty`; expected 0, but got 2
341 // CHECK: see the definition of `test.all_empty` here
342 let foo = op<test.all_empty>(operand1: Value, operand2: Value);
347 #include "include/ops.td"
350 // CHECK: invalid number of result groups for `test.all_empty`; expected 0, but got 2
351 // CHECK: see the definition of `test.all_empty` here
352 let foo = op<test.all_empty> -> (result1: Type, result2: Type);
358 // CHECK: warning: operation result types are marked to be inferred, but
359 // CHECK-SAME: `test.unknown_inferred_result_op` is unknown.
360 // CHECK-SAME: Ensure that `test.unknown_inferred_result_op` supports zero
361 // CHECK-SAME: results or implements `InferTypeOpInterface`.
362 // CHECK-SAME: Include the ODS definition of this operation to remove this
363 // CHECK-SAME: warning.
365 op<test.unknown_inferred_result_op>;
371 #include "include/ops.td"
374 // CHECK: warning: operation result types are marked to be inferred, but
375 // CHECK-SAME: `test.multiple_single_result` does not provide an implementation
376 // CHECK-SAME: of `InferTypeOpInterface`. Ensure that `test.multiple_single_result`
377 // CHECK-SAME: attaches `InferTypeOpInterface` at runtime, or add support
378 // CHECK-SAME: to the ODS definition to remove this warning.
379 // CHECK: see the definition of `test.multiple_single_result` here
381 op<test.multiple_single_result>;
387 //===----------------------------------------------------------------------===//
389 //===----------------------------------------------------------------------===//
392 // CHECK: expected string literal containing MLIR type
399 // CHECK: expected `>` after type literal