Jacques Pienaar | bae4051 | 2018-06-24 09:10:36 -0700 | [diff] [blame] | 1 | ; TODO(andydavis) Resolve relative path issue w.r.t invoking mlir-opt in RUN |
| 2 | ; statements (perhaps through using lit config substitutions). |
| 3 | ; |
Jacques Pienaar | ca4c4a0 | 2018-06-25 08:10:46 -0700 | [diff] [blame] | 4 | ; RUN: %S/../../mlir-opt %s -o - -check-parser-errors |
Jacques Pienaar | bae4051 | 2018-06-24 09:10:36 -0700 | [diff] [blame] | 5 | |
| 6 | ; Check different error cases. |
Jacques Pienaar | bae4051 | 2018-06-24 09:10:36 -0700 | [diff] [blame] | 7 | ; ----- |
Chris Lattner | f6d80a0 | 2018-06-24 11:18:29 -0700 | [diff] [blame] | 8 | |
Chris Lattner | f958bbe | 2018-06-29 22:08:05 -0700 | [diff] [blame] | 9 | extfunc @illegaltype(i) ; expected-error {{expected type}} |
Chris Lattner | f6d80a0 | 2018-06-24 11:18:29 -0700 | [diff] [blame] | 10 | |
Jacques Pienaar | bae4051 | 2018-06-24 09:10:36 -0700 | [diff] [blame] | 11 | ; ----- |
Jacques Pienaar | ca4c4a0 | 2018-06-25 08:10:46 -0700 | [diff] [blame] | 12 | |
| 13 | extfunc @nestedtensor(tensor<tensor<i8>>) -> () ; expected-error {{expected type}} |
Chris Lattner | f6d80a0 | 2018-06-24 11:18:29 -0700 | [diff] [blame] | 14 | |
Jacques Pienaar | bae4051 | 2018-06-24 09:10:36 -0700 | [diff] [blame] | 15 | ; ----- |
Jacques Pienaar | ca4c4a0 | 2018-06-25 08:10:46 -0700 | [diff] [blame] | 16 | |
Jacques Pienaar | bae4051 | 2018-06-24 09:10:36 -0700 | [diff] [blame] | 17 | cfgfunc @foo() |
Jacques Pienaar | ca4c4a0 | 2018-06-25 08:10:46 -0700 | [diff] [blame] | 18 | cfgfunc @bar() ; expected-error {{expected '{' in CFG function}} |
Chris Lattner | f6d80a0 | 2018-06-24 11:18:29 -0700 | [diff] [blame] | 19 | |
Jacques Pienaar | bae4051 | 2018-06-24 09:10:36 -0700 | [diff] [blame] | 20 | ; ----- |
Jacques Pienaar | ca4c4a0 | 2018-06-25 08:10:46 -0700 | [diff] [blame] | 21 | |
Chris Lattner | f958bbe | 2018-06-29 22:08:05 -0700 | [diff] [blame] | 22 | extfunc missingsigil() -> (i1, affineint, f32) ; expected-error {{expected a function identifier like}} |
Chris Lattner | f6d80a0 | 2018-06-24 11:18:29 -0700 | [diff] [blame] | 23 | |
| 24 | |
| 25 | ; ----- |
| 26 | |
| 27 | cfgfunc @bad_branch() { |
| 28 | bb42: |
Jacques Pienaar | ca4c4a0 | 2018-06-25 08:10:46 -0700 | [diff] [blame] | 29 | br missing ; expected-error {{reference to an undefined basic block 'missing'}} |
Chris Lattner | f6d80a0 | 2018-06-24 11:18:29 -0700 | [diff] [blame] | 30 | } |
| 31 | |
| 32 | ; ----- |
| 33 | |
| 34 | cfgfunc @block_redef() { |
| 35 | bb42: |
| 36 | return |
Jacques Pienaar | ca4c4a0 | 2018-06-25 08:10:46 -0700 | [diff] [blame] | 37 | bb42: ; expected-error {{redefinition of block 'bb42'}} |
| 38 | return |
| 39 | } |
| 40 | |
| 41 | ; ----- |
| 42 | |
| 43 | cfgfunc @no_terminator() { |
| 44 | bb40: |
| 45 | return |
| 46 | bb41: |
Chris Lattner | ed65a73 | 2018-06-28 20:45:33 -0700 | [diff] [blame] | 47 | bb42: ; expected-error {{expected operation name}} |
Chris Lattner | f6d80a0 | 2018-06-24 11:18:29 -0700 | [diff] [blame] | 48 | return |
| 49 | } |
Tatiana Shpeisman | c96b587 | 2018-06-28 17:02:32 -0700 | [diff] [blame] | 50 | |
| 51 | ; ----- |
| 52 | |
| 53 | mlfunc @foo() |
| 54 | mlfunc @bar() ; expected-error {{expected '{' in ML function}} |
| 55 | |
| 56 | ; ----- |
| 57 | |
| 58 | mlfunc @no_return() { |
| 59 | } ; expected-error {{ML function must end with return statement}} |
Chris Lattner | ed65a73 | 2018-06-28 20:45:33 -0700 | [diff] [blame] | 60 | |
| 61 | ; ----- |
| 62 | |
| 63 | " ; expected-error {{expected}} |
| 64 | " |
| 65 | |
| 66 | ; ----- |
| 67 | |
| 68 | " ; expected-error {{expected}} |
| 69 | |
| 70 | ; ----- |
| 71 | |
| 72 | cfgfunc @no_terminator() { |
| 73 | bb40: |
| 74 | "foo"() |
| 75 | ""() ; expected-error {{empty operation name is invalid}} |
| 76 | return |
| 77 | } |
Chris Lattner | f958bbe | 2018-06-29 22:08:05 -0700 | [diff] [blame] | 78 | |
| 79 | ; ----- |
| 80 | |
| 81 | extfunc @illegaltype(i0) ; expected-error {{invalid integer width}} |
| 82 | |
Tatiana Shpeisman | bf079c9 | 2018-07-03 17:51:28 -0700 | [diff] [blame] | 83 | ; ----- |
Chris Lattner | f958bbe | 2018-06-29 22:08:05 -0700 | [diff] [blame] | 84 | |
Tatiana Shpeisman | bf079c9 | 2018-07-03 17:51:28 -0700 | [diff] [blame] | 85 | mlfunc @incomplete_for() { |
| 86 | for |
| 87 | } ; expected-error {{expected '{' before statement list}} |
| 88 | |
| 89 | ; ----- |
| 90 | |
| 91 | mlfunc @non_statement() { |
| 92 | asd ; expected-error {{expected statement}} |
| 93 | } |
Chris Lattner | 7121b80 | 2018-07-04 20:45:39 -0700 | [diff] [blame] | 94 | |
| 95 | ; ----- |
| 96 | |
Chris Lattner | 21e67f6 | 2018-07-06 10:46:19 -0700 | [diff] [blame^] | 97 | cfgfunc @malformed_dim() { |
| 98 | bb42: |
| 99 | "dim"(){index: "xyz"} ; expected-error {{'dim' op requires an integer attribute named 'index'}} |
| 100 | return |
| 101 | } |
| 102 | |
| 103 | ; ----- |