xref: /llvm-project/mlir/test/Dialect/PDLInterp/invalid.mlir (revision 363b655920c49a4bcb0869f820ed40aac834eebd)
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics
2
3//===----------------------------------------------------------------------===//
4// pdl_interp::CreateOperationOp
5//===----------------------------------------------------------------------===//
6
7pdl_interp.func @rewriter() {
8  // expected-error@+1 {{op has inferred results, but the created operation 'foo.op' does not support result type inference}}
9  %op = pdl_interp.create_operation "foo.op" -> <inferred>
10  pdl_interp.finalize
11}
12
13// -----
14
15pdl_interp.func @rewriter() {
16  %type = pdl_interp.create_type i32
17  // expected-error@+1 {{op with inferred results cannot also have explicit result types}}
18  %op = "pdl_interp.create_operation"(%type) {
19    inferredResultTypes,
20    inputAttributeNames = [],
21    name = "foo.op",
22    operandSegmentSizes = array<i32: 0, 0, 1>
23  } : (!pdl.type) -> (!pdl.operation)
24  pdl_interp.finalize
25}
26
27// -----
28
29//===----------------------------------------------------------------------===//
30// pdl_interp::CreateRangeOp
31//===----------------------------------------------------------------------===//
32
33pdl_interp.func @rewriter(%value: !pdl.value, %type: !pdl.type) {
34  // expected-error @below {{expected operand to have element type '!pdl.value', but got '!pdl.type'}}
35  %range = pdl_interp.create_range %value, %type : !pdl.value, !pdl.type
36  pdl_interp.finalize
37}
38