blob: 684c5a98cf347cf739df0b90327a918abf8683c6 [file] [log] [blame]
Jacques Pienaarbae40512018-06-24 09:10:36 -07001; TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
2; statements (perhaps through using lit config substitutions).
3;
Jacques Pienaarca4c4a02018-06-25 08:10:46 -07004; RUN: %S/../../mlir-opt %s -o - -check-parser-errors
Jacques Pienaarbae40512018-06-24 09:10:36 -07005
6; Check different error cases.
Jacques Pienaarbae40512018-06-24 09:10:36 -07007; -----
Chris Lattnerf6d80a02018-06-24 11:18:29 -07008
Chris Lattnerf958bbe2018-06-29 22:08:05 -07009extfunc @illegaltype(i) ; expected-error {{expected type}}
Chris Lattnerf6d80a02018-06-24 11:18:29 -070010
Jacques Pienaarbae40512018-06-24 09:10:36 -070011; -----
Jacques Pienaarca4c4a02018-06-25 08:10:46 -070012
13extfunc @nestedtensor(tensor<tensor<i8>>) -> () ; expected-error {{expected type}}
Chris Lattnerf6d80a02018-06-24 11:18:29 -070014
Jacques Pienaarbae40512018-06-24 09:10:36 -070015; -----
Jacques Pienaarca4c4a02018-06-25 08:10:46 -070016
Jacques Pienaarbae40512018-06-24 09:10:36 -070017cfgfunc @foo()
Jacques Pienaarca4c4a02018-06-25 08:10:46 -070018cfgfunc @bar() ; expected-error {{expected '{' in CFG function}}
Chris Lattnerf6d80a02018-06-24 11:18:29 -070019
Jacques Pienaarbae40512018-06-24 09:10:36 -070020; -----
Jacques Pienaarca4c4a02018-06-25 08:10:46 -070021
Chris Lattnerf958bbe2018-06-29 22:08:05 -070022extfunc missingsigil() -> (i1, affineint, f32) ; expected-error {{expected a function identifier like}}
Chris Lattnerf6d80a02018-06-24 11:18:29 -070023
24
25; -----
26
27cfgfunc @bad_branch() {
28bb42:
Jacques Pienaarca4c4a02018-06-25 08:10:46 -070029 br missing ; expected-error {{reference to an undefined basic block 'missing'}}
Chris Lattnerf6d80a02018-06-24 11:18:29 -070030}
31
32; -----
33
34cfgfunc @block_redef() {
35bb42:
36 return
Jacques Pienaarca4c4a02018-06-25 08:10:46 -070037bb42: ; expected-error {{redefinition of block 'bb42'}}
38 return
39}
40
41; -----
42
43cfgfunc @no_terminator() {
44bb40:
45 return
46bb41:
Chris Lattnered65a732018-06-28 20:45:33 -070047bb42: ; expected-error {{expected operation name}}
Chris Lattnerf6d80a02018-06-24 11:18:29 -070048 return
49}
Tatiana Shpeismanc96b5872018-06-28 17:02:32 -070050
51; -----
52
53mlfunc @foo()
54mlfunc @bar() ; expected-error {{expected '{' in ML function}}
55
56; -----
57
58mlfunc @no_return() {
59} ; expected-error {{ML function must end with return statement}}
Chris Lattnered65a732018-06-28 20:45:33 -070060
61; -----
62
63" ; expected-error {{expected}}
64"
65
66; -----
67
68" ; expected-error {{expected}}
69
70; -----
71
72cfgfunc @no_terminator() {
73bb40:
74 "foo"()
75 ""() ; expected-error {{empty operation name is invalid}}
76 return
77}
Chris Lattnerf958bbe2018-06-29 22:08:05 -070078
79; -----
80
81extfunc @illegaltype(i0) ; expected-error {{invalid integer width}}
82
Tatiana Shpeismanbf079c92018-07-03 17:51:28 -070083; -----
Chris Lattnerf958bbe2018-06-29 22:08:05 -070084
Tatiana Shpeismanbf079c92018-07-03 17:51:28 -070085mlfunc @incomplete_for() {
86 for
87} ; expected-error {{expected '{' before statement list}}
88
89; -----
90
91mlfunc @non_statement() {
92 asd ; expected-error {{expected statement}}
93}