Fix b/112189633, where we'd produce errors but not return failure from the
parser.  I'm not sure how to write a (non-ridiculous) testcase for this.

PiperOrigin-RevId: 207606942
diff --git a/lib/Parser/Parser.cpp b/lib/Parser/Parser.cpp
index e84cb86..b50e950 100644
--- a/lib/Parser/Parser.cpp
+++ b/lib/Parser/Parser.cpp
@@ -1581,7 +1581,8 @@
       return emitError(loc, "cannot name an operation with no results");
 
     for (unsigned i = 0, e = op->getNumResults(); i != e; ++i)
-      addDefinition({resultID, i, loc}, op->getResult(i));
+      if (addDefinition({resultID, i, loc}, op->getResult(i)))
+        return ParseFailure;
   }
 
   return ParseSuccess;
@@ -1901,7 +1902,7 @@
     auto type = parseSSADefOrUseAndType<Type *>(
         [&](SSAUseInfo useInfo, Type *type) -> Type * {
           BBArgument *arg = owner->addArgument(type);
-          if (addDefinition(useInfo, arg) == ParseFailure)
+          if (addDefinition(useInfo, arg))
             return nullptr;
           return type;
         });
@@ -2174,7 +2175,8 @@
   ForStmt *forStmt = builder.createFor(lowerBound, upperBound, step);
 
   // Create SSA value definition for the induction variable.
-  addDefinition({inductionVariableName, 0, loc}, forStmt);
+  if (addDefinition({inductionVariableName, 0, loc}, forStmt))
+    return ParseFailure;
 
   // If parsing of the for statement body fails,
   // MLIR contains for statement with those nested statements that have been