| Index: runtime/vm/parser.cc
|
| ===================================================================
|
| --- runtime/vm/parser.cc (revision 21216)
|
| +++ runtime/vm/parser.cc (working copy)
|
| @@ -3071,14 +3071,19 @@
|
| ErrorMsg(member.name_pos, "factory name must be '%s'",
|
| members->class_name().ToCString());
|
| }
|
| + // Do not bypass class resolution by using current_class() directly, since
|
| + // it may be a patch class.
|
| const Object& result_type_class = Object::Handle(
|
| UnresolvedClass::New(LibraryPrefix::Handle(),
|
| *member.name,
|
| member.name_pos));
|
| - // The type arguments of the result type are set during finalization.
|
| - member.type = &Type::ZoneHandle(Type::New(result_type_class,
|
| - TypeArguments::Handle(),
|
| - member.name_pos));
|
| + // The type arguments of the result type are the type parameters of the
|
| + // current class. Note that in the case of a patch class, they are copied
|
| + // from the class being patched.
|
| + member.type = &Type::ZoneHandle(Type::New(
|
| + result_type_class,
|
| + TypeArguments::Handle(current_class().type_parameters()),
|
| + member.name_pos));
|
| } else if (member.has_static) {
|
| ErrorMsg(member.name_pos, "constructor cannot be static");
|
| }
|
| @@ -3301,6 +3306,11 @@
|
| class_name.ToCString(),
|
| String::Handle(super_type.UserVisibleName()).ToCString());
|
| }
|
| + if (super_type.IsDynamicType()) {
|
| + ErrorMsg(type_pos,
|
| + "class '%s' may not extend 'dynamic'",
|
| + class_name.ToCString());
|
| + }
|
| if (CurrentToken() == Token::kWITH) {
|
| super_type = ParseMixins(super_type);
|
| }
|
| @@ -3842,6 +3852,9 @@
|
| "type parameter '%s' may not be used in interface list",
|
| String::Handle(interface.UserVisibleName()).ToCString());
|
| }
|
| + if (interface.IsDynamicType()) {
|
| + ErrorMsg(interface_pos, "'dynamic' may not be used in interface list");
|
| + }
|
| all_interfaces.Add(interface);
|
| } while (CurrentToken() == Token::kCOMMA);
|
| cls_interfaces = Array::MakeArray(all_interfaces);
|
|
|