[VM/Runtime] Fix error message from type error exception string.

(Should fix https://github.com/dart-lang/sdk/issues/50756)

TEST=ci

Change-Id: Id605aac4157c774c51577603d77e8ce21f58bd40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282123
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
This commit is contained in:
asiva 2023-02-10 14:26:19 +00:00 committed by Commit Queue
parent 41d6db8ce5
commit 3a096ab1ce

View file

@ -912,10 +912,14 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location,
pieces.Add(String::Handle(zone, dst_type.UserVisibleName()));
pieces.Add(Symbols::SingleQuote());
if (dst_name.Length() > 0) {
pieces.Add(Symbols::SpaceOfSpace());
pieces.Add(Symbols::SingleQuote());
pieces.Add(dst_name);
pieces.Add(Symbols::SingleQuote());
if (dst_name.ptr() == Symbols::InTypeCast().ptr()) {
pieces.Add(dst_name);
} else {
pieces.Add(Symbols::SpaceOfSpace());
pieces.Add(Symbols::SingleQuote());
pieces.Add(dst_name);
pieces.Add(Symbols::SingleQuote());
}
}
// Print ambiguous URIs of src and dst types.
URIs uris(zone, 12);