diff --git a/flang/lib/Optimizer/Dialect/FIROps.cpp b/flang/lib/Optimizer/Dialect/FIROps.cpp --- a/flang/lib/Optimizer/Dialect/FIROps.cpp +++ b/flang/lib/Optimizer/Dialect/FIROps.cpp @@ -914,9 +914,9 @@ if (parser.parseOptionalAttrDict(result.attributes) || parser.parseColonType(funcTy) || parser.resolveOperands(allOperands, funcTy.getInputs(), loc, - result.operands)) + result.operands) || + parser.addTypesToList(funcTy.getResults(), result.types)) return mlir::failure(); - parser.addTypesToList(funcTy.getResults(), result.types); result.addAttribute("baseType", mlir::TypeAttr::get(funcTy.getInput(0))); return mlir::success(); } diff --git a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp --- a/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp +++ b/mlir/lib/Dialect/SPIRV/IR/SPIRVOps.cpp @@ -3112,15 +3112,15 @@ ParseResult spirv::ModuleOp::parse(OpAsmParser &parser, OperationState &state) { Region *body = state.addRegion(); - StringAttr nameAttr; - spirv::AddressingModel addrModel; - spirv::MemoryModel memoryModel; // If the name is present, parse it. + StringAttr nameAttr; (void)parser.parseOptionalSymbolName( nameAttr, mlir::SymbolTable::getSymbolAttrName(), state.attributes); // Parse attributes + spirv::AddressingModel addrModel; + spirv::MemoryModel memoryModel; if (::parseEnumKeywordAttr(addrModel, parser, state) || ::parseEnumKeywordAttr(memoryModel, parser, state)) return failure(); diff --git a/mlir/lib/Parser/AffineParser.cpp b/mlir/lib/Parser/AffineParser.cpp --- a/mlir/lib/Parser/AffineParser.cpp +++ b/mlir/lib/Parser/AffineParser.cpp @@ -518,7 +518,7 @@ if (consumeIf(Token::arrow)) return parseAffineMapRange(numDims, numSymbols, map); - if (parseToken(Token::colon, "expected '->' or '['")) + if (parseToken(Token::colon, "expected '->' or ':'")) return failure(); return parseIntegerSetConstraints(numDims, numSymbols, set); } diff --git a/mlir/test/IR/invalid.mlir b/mlir/test/IR/invalid.mlir --- a/mlir/test/IR/invalid.mlir +++ b/mlir/test/IR/invalid.mlir @@ -932,7 +932,7 @@ func.func @invalid_affine_structure() { %c0 = arith.constant 0 : index - %idx = affine.apply affine_map<(d0, d1)> (%c0, %c0) // expected-error {{expected '->' or '['}} + %idx = affine.apply affine_map<(d0, d1)> (%c0, %c0) // expected-error {{expected '->' or ':'}} return }