// RUN: mlir-opt %s -split-input-file -verify-diagnostics| FileCheck %s // CHECK-LABEL: @test_struct_attr_roundtrip func.func @test_struct_attr_roundtrip() -> () { // CHECK: attr = #test.custom_struct "test.op"() {attr = #test.custom_struct} : () -> () // CHECK: attr = #test.custom_struct "test.op"() {attr = #test.custom_struct} : () -> () // CHECK: attr = #test.custom_struct "test.op"() {attr = #test.custom_struct} : () -> () // CHECK: attr = #test.custom_struct "test.op"() {attr = #test.custom_struct} : () -> () // CHECK: attr = #test.custom_struct "test.op"() {attr = #test.custom_struct} : () -> () return } // ----- // Verify all required parameters must be provided. `value` is missing. // expected-error @below {{struct is missing required parameter: value}} "test.op"() {attr = #test.custom_struct} : () -> () // ----- // Verify all keywords must be provided. All missing. // expected-error @below {{expected valid keyword}} // expected-error @below {{expected a parameter name in struct}} "test.op"() {attr = #test.custom_struct<"struct", 2>} : () -> () // ----- // Verify all keywords must be provided. `type_str` missing. // expected-error @below {{expected valid keyword}} // expected-error @below {{expected a parameter name in struct}} "test.op"() {attr = #test.custom_struct<"struct", value = 2, opt_value = [3, 3]>} : () -> () // ----- // Verify all keywords must be provided. `value` missing. // expected-error @below {{expected valid keyword}} // expected-error @below {{expected a parameter name in struct}} "test.op"() {attr = #test.custom_struct} : () -> () // ----- // Verify invalid keyword provided. // expected-error @below {{duplicate or unknown struct parameter name: type_str2}} "test.op"() {attr = #test.custom_struct} : () -> () // ----- // Verify duplicated keyword provided. // expected-error @below {{duplicate or unknown struct parameter name: type_str}} "test.op"() {attr = #test.custom_struct} : () -> () // ----- // Verify equals missing. // expected-error @below {{expected '='}} "test.op"() {attr = #test.custom_struct} : () -> ()