107 lines · plain
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics2 3// -----4 5func.func @func_op() {6 // expected-error@+1 {{expected valid '@'-identifier for symbol name}}7 func.func missingsigil() -> (i1, index, f32)8 return9}10 11// -----12 13func.func @func_op() {14 // expected-error@+1 {{expected type instead of SSA identifier}}15 func.func @mixed_named_arguments(f32, %a : i32) {16 return17 }18 return19}20 21// -----22 23func.func @func_op() {24 // expected-error@+1 {{expected SSA identifier}}25 func.func @mixed_named_arguments(%a : i32, f32) -> () {26 return27 }28 return29}30 31// -----32 33func.func @func_op() {34 // expected-error@+1 {{op symbol's parent must have the SymbolTable trait}}35 func.func @mixed_named_arguments(f32) {36 ^entry:37 return38 }39 return40}41 42// -----43 44func.func @func_op() {45 // expected-error@+1 {{op symbol's parent must have the SymbolTable trait}}46 func.func @mixed_named_arguments(f32) {47 ^entry(%arg : i32):48 return49 }50 return51}52 53// -----54 55// expected-error@+1 {{expected non-function type}}56func.func @f() -> (foo57 58// -----59 60// expected-error@+1 {{expected attribute name}}61func.func @f() -> (i1 {)62 63// -----64 65// expected-error@+1 {{invalid to use 'test.invalid_attr'}}66func.func @f(%arg0: i64 {test.invalid_attr}) {67 return68}69 70// -----71 72// expected-error@+1 {{invalid to use 'test.invalid_attr'}}73func.func @f(%arg0: i64) -> (i64 {test.invalid_attr}) {74 return %arg0 : i6475}76 77// -----78 79// expected-error@+1 {{symbol declaration cannot have public visibility}}80func.func @invalid_public_declaration()81 82// -----83 84// expected-error@+1 {{'sym_visibility' is an inferred attribute and should not be specified in the explicit attribute dictionary}}85func.func @legacy_visibility_syntax() attributes { sym_visibility = "private" }86 87// -----88 89// expected-error@+1 {{'sym_name' is an inferred attribute and should not be specified in the explicit attribute dictionary}}90func.func private @invalid_symbol_name_attr() attributes { sym_name = "x" }91 92// -----93 94// expected-error@+1 {{'function_type' is an inferred attribute and should not be specified in the explicit attribute dictionary}}95func.func private @invalid_symbol_type_attr() attributes { function_type = "x" }96 97// -----98 99// expected-error@+1 {{argument attribute array to have the same number of elements as the number of function arguments}}100func.func private @invalid_arg_attrs() attributes { arg_attrs = [{}] }101 102// -----103 104 105// expected-error@+1 {{result attribute array to have the same number of elements as the number of function results}}106func.func private @invalid_res_attrs() attributes { res_attrs = [{}] }107