aboutsummaryrefslogtreecommitdiff
path: root/mlir/test/mlir-tblgen/attr-or-type-builder-invalid.td
blob: 4db71621845501d4aaf6c5212d53d75197455de4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
// RUN: not mlir-tblgen -gen-typedef-defs -I %S/../../include %s 2>&1 | FileCheck %s

include "mlir/IR/AttrTypeBase.td"
include "mlir/IR/OpBase.td"

def Test_Dialect : Dialect {
  let name = "TestDialect";
  let cppNamespace = "::test";
}

class InvalidType<string name> : TypeDef<Test_Dialect, name> {
  let mnemonic = ?;
}

// This definition should not generate an error due to the use in `InvalidTypeA`
// CHECK-NOT: Record `TestParameter' does not have a field named `type'!
def TestParameter : TypeParameter<"int", "int parameter">;

// Test builder uses wrong record class.
def InvalidTypeA : InvalidType<"InvalidTypeA"> {
  let parameters = (ins "int":$v0);
  let builders = [
    // CHECK: Builder DAG arguments must be either strings or defs which inherit from CArg
    TypeBuilder<(ins TestParameter:$arg0), [{
      return $_get($_ctxt, arg0);
    }]>
  ];
}