Adds MemRef type and adds support for parsing memref affine map composition.
PiperOrigin-RevId: 204756982
diff --git a/test/IR/parser-errors.mlir b/test/IR/parser-errors.mlir
index 27a53bd..ff03b51 100644
--- a/test/IR/parser-errors.mlir
+++ b/test/IR/parser-errors.mlir
@@ -13,6 +13,47 @@
extfunc @nestedtensor(tensor<tensor<i8>>) -> () // expected-error {{expected type}}
// -----
+// Test no comma in memref type.
+// TODO(andydavis) Fix this test if we decide to allow empty affine map to
+// imply identity affine map.
+extfunc @memrefs(memref<2x4xi8>) ; expected-error {{expected ',' in memref type}}
+
+// -----
+// Test no map in memref type.
+extfunc @memrefs(memref<2x4xi8, >) ; expected-error {{expected list element}}
+
+// -----
+// Test non-existent map in memref type.
+extfunc @memrefs(memref<2x4xi8, #map7>) ; expected-error {{undefined affine map id 'map7'}}
+
+// -----
+// Test non hash identifier in memref type.
+extfunc @memrefs(memref<2x4xi8, %map7>) ; expected-error {{expected '(' at start of dimensional identifiers list}}
+
+// -----
+// Test non-existent map in map composition of memref type.
+#map0 = (d0, d1) -> (d0, d1)
+
+extfunc @memrefs(memref<2x4xi8, #map0, #map8>) ; expected-error {{undefined affine map id 'map8'}}
+
+// -----
+// Test multiple memory space error.
+#map0 = (d0, d1) -> (d0, d1)
+extfunc @memrefs(memref<2x4xi8, #map0, 1, 2>) ; expected-error {{multiple memory spaces specified in memref type}}
+
+// -----
+// Test affine map after memory space.
+#map0 = (d0, d1) -> (d0, d1)
+#map1 = (d0, d1) -> (d0, d1)
+
+extfunc @memrefs(memref<2x4xi8, #map0, 1, #map1>) ; expected-error {{affine map after memory space in memref type}}
+
+// -----
+// Test no memory space error.
+#map0 = (d0, d1) -> (d0, d1)
+extfunc @memrefs(memref<2x4xi8, #map0>) ; expected-error {{expected memory space in memref type}}
+
+// -----
cfgfunc @foo()
cfgfunc @bar() // expected-error {{expected '{' in CFG function}}