xref: /llvm-project/mlir/test/Dialect/Index/index-errors.mlir (revision ddf87d6cd40416b306c55a02f3646018c2293a7c)
1// RUN: mlir-opt -split-input-file -verify-diagnostics %s
2
3func.func @invalid_cast(%a: index) {
4  // expected-error @below {{cast incompatible}}
5  %0 = index.casts %a : index to index
6  return
7}
8
9// -----
10
11func.func @invalid_cast(%a: i64) {
12  // expected-error @below {{cast incompatible}}
13  %0 = index.casts %a : i64 to i64
14  return
15}
16
17// -----
18
19func.func @invalid_cast(%a: index) {
20  // expected-error @below {{cast incompatible}}
21  %0 = index.castu %a : index to index
22  return
23}
24
25// -----
26
27func.func @invalid_cast(%a: i64) {
28  // expected-error @below {{cast incompatible}}
29  %0 = index.castu %a : i64 to i64
30  return
31}
32