1 // RUN: not mlir-pdll %s -split-input-file 2>&1 | FileCheck %s
3 //===----------------------------------------------------------------------===//
4 // Constraint Structure
5 //===----------------------------------------------------------------------===//
7 // CHECK: expected identifier name
12 // CHECK: :6:12: error: `Foo` has already been defined
13 // CHECK: :5:12: note: see previous definition here
14 Constraint Foo() { op<>; }
15 Constraint Foo() { op<>; }
20 // CHECK: `erase` cannot be used within a Constraint
27 // CHECK: `replace` cannot be used within a Constraint
34 // CHECK: `rewrite` cannot be used within a Constraint
40 Constraint Foo() -> Value {
41 // CHECK: `return` terminated the `Constraint` body, but found trailing statements afterwards
48 // CHECK: missing return in a `Constraint` expected to return `Value`
49 Constraint Foo() -> Value {
55 // CHECK: expected `Constraint` lambda body to contain a single expression
56 Constraint Foo() -> Value => let foo: Value;
60 // CHECK: unable to convert expression of type `Op` to the expected type of `Attr`
61 Constraint Foo() -> Attr => op<>;
65 Rewrite SomeRewrite();
67 // CHECK: unable to invoke `Rewrite` within a match section
80 //===----------------------------------------------------------------------===//
82 //===----------------------------------------------------------------------===//
84 // CHECK: expected `(` to start argument list
89 // CHECK: expected identifier argument name
94 // CHECK: expected `:` before argument constraint
99 // CHECK: inline `Attr`, `Value`, and `ValueRange` type constraints are not permitted on arguments or results
100 Constraint Foo(arg: Value<type>){}
104 // CHECK: expected `)` to end argument list
105 Constraint Foo(arg: Value{}
109 //===----------------------------------------------------------------------===//
111 //===----------------------------------------------------------------------===//
113 // CHECK: expected identifier constraint
114 Constraint Foo() -> {}
118 // CHECK: cannot create a single-element tuple with an element label
119 Constraint Foo() -> result: Value {}
123 // CHECK: cannot create a single-element tuple with an element label
124 Constraint Foo() -> (result: Value) {}
128 // CHECK: expected identifier constraint
129 Constraint Foo() -> () {}
133 // CHECK: expected `:` before result constraint
134 Constraint Foo() -> (result {};
138 // CHECK: expected `)` to end result list
139 Constraint Foo() -> (Op{};
143 // CHECK: inline `Attr`, `Value`, and `ValueRange` type constraints are not permitted on arguments or results
144 Constraint Foo() -> Value<type>) {}
148 //===----------------------------------------------------------------------===//
149 // Native Constraints
150 //===----------------------------------------------------------------------===//
153 // CHECK: external declarations must be declared in global scope
154 Constraint ExternalConstraint();
159 // CHECK: expected `;` after native declaration
160 Constraint Foo() [{}]