Index: runtime/vm/exceptions.cc |
diff --git a/runtime/vm/exceptions.cc b/runtime/vm/exceptions.cc |
index 654f7f63ca9eed5559408136c3310a9f5b4351f5..e2fa84e5de257b8ab4ce9ffa99bc395a877e3bc2 100644 |
--- a/runtime/vm/exceptions.cc |
+++ b/runtime/vm/exceptions.cc |
@@ -493,12 +493,24 @@ void Exceptions::CreateAndThrowTypeError(TokenPosition location, |
pieces.Add(Symbols::SingleQuote()); |
} |
// Print URIs of src and dst types. |
- pieces.Add(Symbols::SpaceWhereNewLine()); |
+ // Do not print "where" when no URIs get printed. |
+ bool printed_where = false; |
if (!src_type.IsNull()) { |
- pieces.Add(String::Handle(zone, src_type.EnumerateURIs())); |
+ const String& uris = String::Handle(zone, src_type.EnumerateURIs()); |
+ if (uris.Length() > Symbols::SpaceIsFromSpace().Length()) { |
+ printed_where = true; |
+ pieces.Add(Symbols::SpaceWhereNewLine()); |
+ pieces.Add(uris); |
+ } |
} |
if (!dst_type.IsDynamicType() && !dst_type.IsVoidType()) { |
- pieces.Add(String::Handle(zone, dst_type.EnumerateURIs())); |
+ const String& uris = String::Handle(zone, dst_type.EnumerateURIs()); |
+ if (uris.Length() > Symbols::SpaceIsFromSpace().Length()) { |
+ if (!printed_where) { |
+ pieces.Add(Symbols::SpaceWhereNewLine()); |
+ } |
+ pieces.Add(uris); |
+ } |
} |
} |
} |