brintos

brintos / llvm-project-archived public Read only

0
0
Text · 3.3 KiB · dd8843d Raw
148 lines · plain
1// RUN: not mlir-pdll %s -split-input-file 2>&1 | FileCheck %s2 3//===----------------------------------------------------------------------===//4// Rewrite Structure5//===----------------------------------------------------------------------===//6 7// CHECK: expected identifier name8Rewrite {}9 10// -----11 12// CHECK: :6:9: error: `Foo` has already been defined13// CHECK: :5:9: note: see previous definition here14Rewrite Foo();15Rewrite Foo();16 17// -----18 19Rewrite Foo() -> Value {20  // CHECK: `return` terminated the `Rewrite` body, but found trailing statements afterwards21  return _: Value;22  return _: Value;23}24 25// -----26 27// CHECK: missing return in a `Rewrite` expected to return `Value`28Rewrite Foo() -> Value {29  let value: Value;30}31 32// -----33 34// CHECK: missing return in a `Rewrite` expected to return `Value`35Rewrite Foo() -> Value => erase op<my_dialect.foo>;36 37// -----38 39// CHECK: unable to convert expression of type `Op<my_dialect.foo>` to the expected type of `Attr`40Rewrite Foo() -> Attr => op<my_dialect.foo>;41 42// -----43 44// CHECK: expected `Rewrite` lambda body to contain a single expression or an operation rewrite statement; such as `erase`, `replace`, or `rewrite`45Rewrite Foo() => let foo = op<my_dialect.foo>;46 47// -----48 49Constraint ValueConstraint(value: Value);50 51// CHECK: unable to invoke `Constraint` within a rewrite section52Rewrite Foo(value: Value) {53  ValueConstraint(value);54}55 56// -----57 58Rewrite Bar();59 60// CHECK: `Bar` has already been defined61Rewrite Foo() {62  Rewrite Bar() {};63}64 65// -----66 67//===----------------------------------------------------------------------===//68// Arguments69//===----------------------------------------------------------------------===//70 71// CHECK: expected `(` to start argument list72Rewrite Foo {}73 74// -----75 76// CHECK: expected identifier argument name77Rewrite Foo(10{}78 79// -----80 81// CHECK: expected `:` before argument constraint82Rewrite Foo(arg{}83 84// -----85 86// CHECK: inline `Attr`, `Value`, and `ValueRange` type constraints are not permitted on arguments or results87Rewrite Foo(arg: Value<type>){}88 89// -----90 91// CHECK: expected `)` to end argument list92Rewrite Foo(arg: Value{}93 94// -----95 96//===----------------------------------------------------------------------===//97// Results98//===----------------------------------------------------------------------===//99 100// CHECK: expected identifier constraint101Rewrite Foo() -> {}102 103// -----104 105// CHECK: cannot create a single-element tuple with an element label106Rewrite Foo() -> result: Value;107 108// -----109 110// CHECK: cannot create a single-element tuple with an element label111Rewrite Foo() -> (result: Value);112 113// -----114 115// CHECK: expected identifier constraint116Rewrite Foo() -> ();117 118// -----119 120// CHECK: expected `:` before result constraint121Rewrite Foo() -> (result{};122 123// -----124 125// CHECK: expected `)` to end result list126Rewrite Foo() -> (Op{};127 128// -----129 130// CHECK: inline `Attr`, `Value`, and `ValueRange` type constraints are not permitted on arguments or results131Rewrite Foo() -> Value<type>){}132 133// -----134 135//===----------------------------------------------------------------------===//136// Native Rewrites137//===----------------------------------------------------------------------===//138 139Pattern {140  // CHECK: external declarations must be declared in global scope141  Rewrite ExternalConstraint();142}143 144// -----145 146// CHECK: expected `;` after native declaration147Rewrite Foo() [{}]148