106 lines · plain
1// RUN: mlir-opt -verify-diagnostics -split-input-file %s2 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 fourth14 // 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 : index30}31 32// -----33 34func.func @test_non_keyword_prop_enum() -> () {35 // expected-error@+2 {{expected keyword for a test enum}}36 // expected-error@+1 {{invalid value for property value, expected a test enum}}37 test.op_with_enum_prop 038 return39}40 41// -----42 43func.func @test_wrong_keyword_prop_enum() -> () {44 // expected-error@+2 {{expected one of [first, second, third] for a test enum, got: fourth}}45 // expected-error@+1 {{invalid value for property value, expected a test enum}}46 test.op_with_enum_prop fourth47}48 49// -----50 51func.func @test_bad_integer() -> () {52 // expected-error@+1 {{op property 'value' failed to satisfy constraint: a test enum}}53 "test.op_with_enum_prop"() <{value = 4 : i32}> {} : () -> ()54}55 56// -----57 58func.func @test_bit_enum_prop_not_keyword() -> () {59 // expected-error@+2 {{expected keyword for a test bit enum}}60 // expected-error@+1 {{invalid value for property value1, expected a test bit enum}}61 test.op_with_bit_enum_prop 062 return63}64 65// -----66 67func.func @test_bit_enum_prop_wrong_keyword() -> () {68 // expected-error@+2 {{expected one of [read, write, execute] for a test bit enum, got: chroot}}69 // expected-error@+1 {{invalid value for property value1, expected a test bit enum}}70 test.op_with_bit_enum_prop read, chroot : ()71 return72}73 74// -----75 76func.func @test_bit_enum_prop_bad_value() -> () {77 // expected-error@+1 {{op property 'value2' failed to satisfy constraint: a test bit enum}}78 "test.op_with_bit_enum_prop"() <{value1 = 7 : i32, value2 = 8 : i32}> {} : () -> ()79 return80}81 82// -----83 84func.func @test_bit_enum_prop_named_wrong_keyword() -> () {85 // expected-error@+2 {{expected 'bit_enum'}}86 // expected-error@+1 {{invalid value for property value1, expected a test bit enum}}87 test.op_with_bit_enum_prop_named foo<read, execute>88 return89}90 91// -----92 93func.func @test_bit_enum_prop_named_not_open() -> () {94 // expected-error@+2 {{expected '<'}}95 // expected-error@+1 {{invalid value for property value1, expected a test bit enum}}96 test.op_with_bit_enum_prop_named bit_enum read, execute>97}98 99// -----100 101func.func @test_bit_enum_prop_named_not_closed() -> () {102 // expected-error@+2 {{expected '>'}}103 // expected-error@+1 {{invalid value for property value1, expected a test bit enum}}104 test.op_with_bit_enum_prop_named bit_enum<read, execute +105}106