.append("previously defined here");
}
+ if (existing.getType() != value.getType()) {
+ return emitError(useInfo.loc)
+ .append("definition of SSA value '", useInfo.name, "#",
+ useInfo.number, "' has type ", value.getType())
+ .attachNote(getEncodedSourceLocation(entries[useInfo.number].second))
+ .append("previously used here with type ", existing.getType());
+ }
+
// If it was a forward reference, update everything that used it to use
// the actual definition instead, delete the forward ref, and remove it
// from our set of forward references we track.
// expected-error @+1 {{duplicate key in dictionary attribute}}
"foo.op"() {a, a} : () -> ()
}
+
+// -----
+
+func @forward_reference_type_check() -> (i8) {
+ br ^bb2
+
+^bb1:
+ // expected-note @+1 {{previously used here with type 'i8'}}
+ return %1 : i8
+
+^bb2:
+ // expected-error @+1 {{definition of SSA value '%1#0' has type 'f32'}}
+ %1 = "bar"() : () -> (f32)
+ br ^bb1
+}