Print both type in diagnostic emitted on mismatch between def/use of SSA Values (NFC)

The error would look like:

  path/filename.mlir:32:23: error: use of value '%28' expects different type than prior uses: ''i32'' vs ''!_tf.control''

PiperOrigin-RevId: 254874859
This commit is contained in:
Mehdi Amini 2019-06-24 17:51:44 -07:00 committed by A. Unique TensorFlower
parent c32080a1b0
commit 14a10a818b
2 changed files with 4 additions and 2 deletions

View File

@ -2638,7 +2638,9 @@ Value *OperationParser::resolveSSAUse(SSAUseInfo useInfo, Type type) {
return result;
emitError(useInfo.loc, "use of value '")
.append(useInfo.name, "' expects different type than prior uses")
.append(useInfo.name,
"' expects different type than prior uses: ", type, " vs ",
result->getType())
.attachNote(getEncodedSourceLocation(entries[useInfo.number].second))
.append("prior use here");
return nullptr;

View File

@ -366,7 +366,7 @@ func @vectors(vector<1 x vector<1xi32>>, vector<2x4xf32>)
func @condbr_notbool() {
^bb0:
%a = "foo"() : () -> i32 // expected-note {{prior use here}}
cond_br %a, ^bb0, ^bb0 // expected-error {{use of value '%a' expects different type than prior uses}}
cond_br %a, ^bb0, ^bb0 // expected-error {{use of value '%a' expects different type than prior uses: 'i1' vs 'i32'}}
// expected-error@-1 {{expected condition type was boolean (i1)}}
}