xref: /llvm-project/mlir/test/IR/enum-attr-invalid.mlir (revision ab9cdf09f4f03259e7e75c5187139e6628a37815)
1// RUN: mlir-opt -verify-diagnostics -split-input-file %s
2
3func.func @test_invalid_enum_case() -> () {
4  // expected-error@+2 {{expected test::TestEnum to be one of: first, second, third}}
5  // expected-error@+1 {{failed to parse TestEnumAttr}}
6  test.op_with_enum #test<enum fourth>
7}
8
9// -----
10
11func.func @test_invalid_enum_case() -> () {
12  // expected-error@+1 {{expected test::TestEnum to be one of: first, second, third}}
13  test.op_with_enum fourth
14  // expected-error@+1 {{failed to parse TestEnumAttr}}
15}
16
17// -----
18
19func.func @test_invalid_attr() -> () {
20  // expected-error@+1 {{op attribute 'value' failed to satisfy constraint: a test enum}}
21  "test.op_with_enum"() {value = 1 : index} : () -> ()
22}
23
24// -----
25
26func.func @test_parse_invalid_attr() -> () {
27  // expected-error@+2 {{expected valid keyword}}
28  // expected-error@+1 {{failed to parse TestEnumAttr parameter 'value'}}
29  test.op_with_enum 1 : index
30}
31