xref: /llvm-project/mlir/test/Dialect/Async/verify.mlir (revision 145d2a50b86fabe220284ca4a28b67cb8d26f1f1)
1// RUN: mlir-opt %s -split-input-file -verify-diagnostics | FileCheck %s
2
3// FileCheck test must have at least one CHECK statement.
4// CHECK-LABEL: @no_op
5func.func @no_op(%arg0: !async.token) {
6  return
7}
8
9// -----
10
11func.func @wrong_async_await_arg_type(%arg0: f32) {
12  // expected-error @+1 {{'async.await' op operand #0 must be async value type or async token type, but got 'f32'}}
13  async.await %arg0 : f32
14}
15
16// -----
17
18func.func @wrong_async_await_result_type(%arg0: !async.value<f32>) {
19  // expected-error @+1 {{'async.await' op result type 'f64' does not match async value type 'f32'}}
20  %0 = "async.await"(%arg0): (!async.value<f32>) -> f64
21}
22
23
24// -----
25// expected-error @+1 {{'async.func' op result is expected to be at least of size 1, but got 0}}
26async.func @wrong_async_func_void_result_type(%arg0: f32) {
27  return
28}
29
30
31// -----
32// expected-error @+1 {{'async.func' op result type must be async value type or async token type, but got 'f32'}}
33async.func @wrong_async_func_result_type(%arg0: f32) -> f32 {
34  return %arg0 : f32
35}
36
37// -----
38// expected-error @+1 {{'async.func' op  results' (optional) async token type is expected to appear as the 1st return value, but got 2}}
39async.func @wrong_async_func_token_type_placement(%arg0: f32) -> (!async.value<f32>, !async.token) {
40  return %arg0 : f32
41}
42
43// -----
44async.func @wrong_async_func_return_type(%arg0: f32) -> (!async.token, !async.value<i32>) {
45  // expected-error @+1 {{'async.return' op operand types do not match the types returned from the parent FuncOp}}
46  return %arg0 : f32
47}
48