1 // RUN: mlir-pdll %s -I %S -split-input-file | FileCheck %s
4 // CHECK: `-UserConstraintDecl {{.*}} Name<Foo> ResultType<Tuple<>>
10 // CHECK: `-UserConstraintDecl {{.*}} Name<Foo> ResultType<Tuple<>> Code< /* Native Code */ >
11 Constraint Foo() [{ /* Native Code */ }];
15 // Test that native constraints support returning results.
18 // CHECK: `-UserConstraintDecl {{.*}} Name<Foo> ResultType<Attr>
19 Constraint Foo() -> Attr;
24 // CHECK: `-UserConstraintDecl {{.*}} Name<Foo> ResultType<Value>
26 // CHECK: `-VariableDecl {{.*}} Name<arg> Type<Value>
28 // CHECK: `-VariableDecl {{.*}} Name<> Type<Value>
29 // CHECK: `-CompoundStmt {{.*}}
30 // CHECK: `-ReturnStmt {{.*}}
31 // CHECK: `-DeclRefExpr {{.*}} Type<Value>
32 // CHECK: `-VariableDecl {{.*}} Name<arg> Type<Value>
33 Constraint Foo(arg: Value) -> Value => arg;
38 // CHECK: `-UserConstraintDecl {{.*}} Name<Foo> ResultType<Tuple<result1: Value, result2: Attr>>
40 // CHECK: |-VariableDecl {{.*}} Name<result1> Type<Value>
41 // CHECK: | `Constraints`
42 // CHECK: | `-ValueConstraintDecl {{.*}}
43 // CHECK: `-VariableDecl {{.*}} Name<result2> Type<Attr>
44 // CHECK: `Constraints`
45 // CHECK: `-AttrConstraintDecl {{.*}}
46 // CHECK: `-CompoundStmt {{.*}}
47 // CHECK: `-ReturnStmt {{.*}}
48 // CHECK: `-TupleExpr {{.*}} Type<Tuple<result1: Value, result2: Attr>>
49 // CHECK: |-MemberAccessExpr {{.*}} Member<0> Type<Value>
50 // CHECK: | `-TupleExpr {{.*}} Type<Tuple<Value, Attr>>
51 // CHECK: `-MemberAccessExpr {{.*}} Member<1> Type<Attr>
52 // CHECK: `-TupleExpr {{.*}} Type<Tuple<Value, Attr>>
53 Constraint Foo() -> (result1: Value, result2: Attr) => (_: Value, attr<"10">);
58 // CHECK: |-UserConstraintDecl {{.*}} Name<Bar> ResultType<Tuple<>>
59 // CHECK: `-UserConstraintDecl {{.*}} Name<Foo> ResultType<Value>
61 // CHECK: `-VariableDecl {{.*}} Name<arg> Type<Value>
62 // CHECK: `Constraints`
63 // CHECK: `-UserConstraintDecl {{.*}} Name<Bar> ResultType<Tuple<>>
65 // CHECK: `-VariableDecl {{.*}} Name<> Type<Value>
66 // CHECK: `Constraints`
67 // CHECK: `-UserConstraintDecl {{.*}} Name<Bar> ResultType<Tuple<>>
68 Constraint Bar(input: Value);
70 Constraint Foo(arg: Bar) -> Bar => arg;
74 // Test that anonymous constraints are uniquely named.
77 // CHECK: UserConstraintDecl {{.*}} Name<<anonymous_constraint_0>> ResultType<Tuple<>>
78 // CHECK: UserConstraintDecl {{.*}} Name<<anonymous_constraint_1>> ResultType<Attr>
81 Constraint() => attr<"10">;