llvm-project
106 строк · 2.5 Кб
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics
2
3// -----
4
5func.func @func_op() {
6// expected-error@+1 {{expected valid '@'-identifier for symbol name}}
7func.func missingsigil() -> (i1, index, f32)
8return
9}
10
11// -----
12
13func.func @func_op() {
14// expected-error@+1 {{expected type instead of SSA identifier}}
15func.func @mixed_named_arguments(f32, %a : i32) {
16return
17}
18return
19}
20
21// -----
22
23func.func @func_op() {
24// expected-error@+1 {{expected SSA identifier}}
25func.func @mixed_named_arguments(%a : i32, f32) -> () {
26return
27}
28return
29}
30
31// -----
32
33func.func @func_op() {
34// expected-error@+1 {{op symbol's parent must have the SymbolTable trait}}
35func.func @mixed_named_arguments(f32) {
36^entry:
37return
38}
39return
40}
41
42// -----
43
44func.func @func_op() {
45// expected-error@+1 {{op symbol's parent must have the SymbolTable trait}}
46func.func @mixed_named_arguments(f32) {
47^entry(%arg : i32):
48return
49}
50return
51}
52
53// -----
54
55// expected-error@+1 {{expected non-function type}}
56func.func @f() -> (foo
57
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}) {
67return
68}
69
70// -----
71
72// expected-error@+1 {{invalid to use 'test.invalid_attr'}}
73func.func @f(%arg0: i64) -> (i64 {test.invalid_attr}) {
74return %arg0 : i64
75}
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