Return error status when number of operands don't match while parsing.

Previously an error would be emitted but parsing would continue as false was being returned.

PiperOrigin-RevId: 212192167
This commit is contained in:
Jacques Pienaar 2018-09-09 13:41:19 -07:00 committed by jpienaar
parent 9afa796d42
commit d101fb937b
2 changed files with 9 additions and 2 deletions

View File

@ -1832,8 +1832,8 @@ public:
}
if (requiredOperandCount != -1 && result.size() != requiredOperandCount)
emitError(startLoc,
"expected " + Twine(requiredOperandCount) + " operands");
return emitError(startLoc,
"expected " + Twine(requiredOperandCount) + " operands");
return false;
}

View File

@ -121,3 +121,10 @@ mlfunc @calls(%arg0 : i32) {
%x = call @calls() : () -> i32 // expected-error {{reference to function with mismatched type}}
return
}
// -----
cfgfunc @cfgfunc_with_ops(f32) {
bb0(%a : f32):
%sf = addf(%a, %a) : f32 // expected-error {{custom op 'addf' expected 2 operands}}
}