Found it a bit easier to see what mismatches occurred when invoking passes doesn't match.
--
PiperOrigin-RevId:
248597286
for (unsigned i = 0, e = results.size(); i != e; ++i)
if (op.getOperand(i)->getType() != results[i])
- return op.emitError("type of return operand ")
- << i << " doesn't match function result type";
+ return op.emitError()
+ << "type of return operand " << i << " ("
+ << op.getOperand(i)->getType()
+ << ") doesn't match function result type (" << results[i] << ")";
return success();
}
func @return_type_mismatch() -> i32 {
%0 = "foo"() : ()->f32
- return %0 : f32 // expected-error {{type of return operand 0 doesn't match function result type}}
+ return %0 : f32 // expected-error {{type of return operand 0 (f32) doesn't match function result type (i32)}}
}
// -----