2018-06-25 00:10:36 +08:00
|
|
|
; TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN
|
|
|
|
; statements (perhaps through using lit config substitutions).
|
|
|
|
;
|
2018-06-25 23:10:46 +08:00
|
|
|
; RUN: %S/../../mlir-opt %s -o - -check-parser-errors
|
2018-06-25 00:10:36 +08:00
|
|
|
|
|
|
|
; Check different error cases.
|
|
|
|
; -----
|
2018-06-25 02:18:29 +08:00
|
|
|
|
2018-06-30 13:08:05 +08:00
|
|
|
extfunc @illegaltype(i) ; expected-error {{expected type}}
|
2018-06-25 02:18:29 +08:00
|
|
|
|
2018-06-25 00:10:36 +08:00
|
|
|
; -----
|
2018-06-25 23:10:46 +08:00
|
|
|
|
|
|
|
extfunc @nestedtensor(tensor<tensor<i8>>) -> () ; expected-error {{expected type}}
|
2018-06-25 02:18:29 +08:00
|
|
|
|
2018-06-25 00:10:36 +08:00
|
|
|
; -----
|
2018-06-25 23:10:46 +08:00
|
|
|
|
2018-06-25 00:10:36 +08:00
|
|
|
cfgfunc @foo()
|
2018-06-25 23:10:46 +08:00
|
|
|
cfgfunc @bar() ; expected-error {{expected '{' in CFG function}}
|
2018-06-25 02:18:29 +08:00
|
|
|
|
2018-06-25 00:10:36 +08:00
|
|
|
; -----
|
2018-06-25 23:10:46 +08:00
|
|
|
|
2018-06-30 13:08:05 +08:00
|
|
|
extfunc missingsigil() -> (i1, affineint, f32) ; expected-error {{expected a function identifier like}}
|
2018-06-25 02:18:29 +08:00
|
|
|
|
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
cfgfunc @bad_branch() {
|
|
|
|
bb42:
|
2018-06-25 23:10:46 +08:00
|
|
|
br missing ; expected-error {{reference to an undefined basic block 'missing'}}
|
2018-06-25 02:18:29 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
cfgfunc @block_redef() {
|
|
|
|
bb42:
|
|
|
|
return
|
2018-06-25 23:10:46 +08:00
|
|
|
bb42: ; expected-error {{redefinition of block 'bb42'}}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
cfgfunc @no_terminator() {
|
|
|
|
bb40:
|
|
|
|
return
|
|
|
|
bb41:
|
2018-06-29 11:45:33 +08:00
|
|
|
bb42: ; expected-error {{expected operation name}}
|
2018-06-25 02:18:29 +08:00
|
|
|
return
|
|
|
|
}
|
2018-06-29 08:02:32 +08:00
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
mlfunc @foo()
|
|
|
|
mlfunc @bar() ; expected-error {{expected '{' in ML function}}
|
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
mlfunc @no_return() {
|
|
|
|
} ; expected-error {{ML function must end with return statement}}
|
2018-06-29 11:45:33 +08:00
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
" ; expected-error {{expected}}
|
|
|
|
"
|
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
" ; expected-error {{expected}}
|
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
cfgfunc @no_terminator() {
|
|
|
|
bb40:
|
|
|
|
"foo"()
|
|
|
|
""() ; expected-error {{empty operation name is invalid}}
|
|
|
|
return
|
|
|
|
}
|
2018-06-30 13:08:05 +08:00
|
|
|
|
|
|
|
; -----
|
|
|
|
|
|
|
|
extfunc @illegaltype(i0) ; expected-error {{invalid integer width}}
|
|
|
|
|
2018-07-04 08:51:28 +08:00
|
|
|
; -----
|
|
|
|
|
|
|
|
mlfunc @incomplete_for() {
|
|
|
|
for
|
|
|
|
} ; expected-error {{expected '{' before statement list}}
|
2018-06-30 13:08:05 +08:00
|
|
|
|
2018-07-04 08:51:28 +08:00
|
|
|
; -----
|
|
|
|
|
|
|
|
mlfunc @non_statement() {
|
|
|
|
asd ; expected-error {{expected statement}}
|
|
|
|
}
|
2018-07-05 11:45:39 +08:00
|
|
|
|
|
|
|
; -----
|
|
|
|
|
2018-07-07 01:46:19 +08:00
|
|
|
cfgfunc @malformed_dim() {
|
|
|
|
bb42:
|
|
|
|
"dim"(){index: "xyz"} ; expected-error {{'dim' op requires an integer attribute named 'index'}}
|
|
|
|
return
|
|
|
|
}
|
|
|
|
|
|
|
|
; -----
|