1 // RUN: not mlir-pdll %s -split-input-file 2>&1 | FileCheck %s
3 //===----------------------------------------------------------------------===//
5 //===----------------------------------------------------------------------===//
7 // CHECK: expected identifier name
12 // CHECK: :6:9: error: `Foo` has already been defined
13 // CHECK: :5:9: note: see previous definition here
19 Rewrite Foo() -> Value {
20 // CHECK: `return` terminated the `Rewrite` body, but found trailing statements afterwards
27 // CHECK: missing return in a `Rewrite` expected to return `Value`
28 Rewrite Foo() -> Value {
34 // CHECK: missing return in a `Rewrite` expected to return `Value`
35 Rewrite Foo() -> Value => erase op<my_dialect.foo>;
39 // CHECK: unable to convert expression of type `Op<my_dialect.foo>` to the expected type of `Attr`
40 Rewrite Foo() -> Attr => op<my_dialect.foo>;
44 // CHECK: expected `Rewrite` lambda body to contain a single expression or an operation rewrite statement; such as `erase`, `replace`, or `rewrite`
45 Rewrite Foo() => let foo = op<my_dialect.foo>;
49 Constraint ValueConstraint(value: Value);
51 // CHECK: unable to invoke `Constraint` within a rewrite section
52 Rewrite Foo(value: Value) {
53 ValueConstraint(value);
60 // CHECK: `Bar` has already been defined
67 //===----------------------------------------------------------------------===//
69 //===----------------------------------------------------------------------===//
71 // CHECK: expected `(` to start argument list
76 // CHECK: expected identifier argument name
81 // CHECK: expected `:` before argument constraint
86 // CHECK: inline `Attr`, `Value`, and `ValueRange` type constraints are not permitted on arguments or results
87 Rewrite Foo(arg: Value<type>){}
91 // CHECK: expected `)` to end argument list
92 Rewrite Foo(arg: Value{}
96 //===----------------------------------------------------------------------===//
98 //===----------------------------------------------------------------------===//
100 // CHECK: expected identifier constraint
105 // CHECK: cannot create a single-element tuple with an element label
106 Rewrite Foo() -> result: Value;
110 // CHECK: cannot create a single-element tuple with an element label
111 Rewrite Foo() -> (result: Value);
115 // CHECK: expected identifier constraint
120 // CHECK: expected `:` before result constraint
121 Rewrite Foo() -> (result{};
125 // CHECK: expected `)` to end result list
126 Rewrite Foo() -> (Op{};
130 // CHECK: inline `Attr`, `Value`, and `ValueRange` type constraints are not permitted on arguments or results
131 Rewrite Foo() -> Value<type>){}
135 //===----------------------------------------------------------------------===//
137 //===----------------------------------------------------------------------===//
140 // CHECK: external declarations must be declared in global scope
141 Rewrite ExternalConstraint();
146 // CHECK: expected `;` after native declaration