| Index: runtime/vm/code_generator.cc
|
| ===================================================================
|
| --- runtime/vm/code_generator.cc (revision 31614)
|
| +++ runtime/vm/code_generator.cc (working copy)
|
| @@ -616,22 +616,41 @@
|
| // Throw a dynamic type error.
|
| const intptr_t location = GetCallerLocation();
|
| const AbstractType& src_type = AbstractType::Handle(src_instance.GetType());
|
| - const String& src_type_name = String::Handle(src_type.UserVisibleName());
|
| + String& src_type_name = String::Handle(src_type.UserVisibleName());
|
| String& dst_type_name = String::Handle();
|
| + Library& dst_type_lib = Library::Handle();
|
| if (!dst_type.IsInstantiated()) {
|
| // Instantiate dst_type before reporting the error.
|
| const AbstractType& instantiated_dst_type = AbstractType::Handle(
|
| dst_type.InstantiateFrom(instantiator_type_arguments, NULL));
|
| // Note that instantiated_dst_type may be malbounded.
|
| dst_type_name = instantiated_dst_type.UserVisibleName();
|
| + dst_type_lib =
|
| + Class::Handle(instantiated_dst_type.type_class()).library();
|
| } else {
|
| dst_type_name = dst_type.UserVisibleName();
|
| + dst_type_lib = Class::Handle(dst_type.type_class()).library();
|
| }
|
| String& bound_error_message = String::Handle();
|
| if (!bound_error.IsNull()) {
|
| ASSERT(FLAG_enable_type_checks);
|
| bound_error_message = String::New(bound_error.ToErrorCString());
|
| }
|
| + if (src_type_name.Equals(dst_type_name)) {
|
| + // Qualify the names with their libraries.
|
| + String& lib_name = String::Handle();
|
| + lib_name = Library::Handle(
|
| + Class::Handle(src_type.type_class()).library()).name();
|
| + if (lib_name.Length() != 0) {
|
| + lib_name = String::Concat(lib_name, Symbols::Dot());
|
| + src_type_name = String::Concat(lib_name, src_type_name);
|
| + }
|
| + lib_name = dst_type_lib.name();
|
| + if (lib_name.Length() != 0) {
|
| + lib_name = String::Concat(lib_name, Symbols::Dot());
|
| + dst_type_name = String::Concat(lib_name, dst_type_name);
|
| + }
|
| + }
|
| Exceptions::CreateAndThrowTypeError(location, src_type_name, dst_type_name,
|
| dst_name, bound_error_message);
|
| UNREACHABLE();
|
|
|