Chromium Code Reviews| Index: runtime/vm/parser.cc |
| =================================================================== |
| --- runtime/vm/parser.cc (revision 3103) |
| +++ runtime/vm/parser.cc (working copy) |
| @@ -2512,7 +2512,13 @@ |
| Type& super_type = Type::Handle(); |
| if (CurrentToken() == Token::kEXTENDS) { |
| ConsumeToken(); |
| - super_type ^= ParseType(kCanResolve); |
| + const AbstractType& type = AbstractType::Handle(ParseType(kCanResolve)); |
| + if (type.IsTypeParameter()) { |
| + ErrorMsg("class '%s' may not extend type parameter '%s'", |
|
hausner
2012/01/09 18:54:49
I would print the error at the actual text positio
regis
2012/01/09 19:19:30
Done here and on line 2523 below.
|
| + class_name.ToCString(), |
| + String::Handle(type.Name()).ToCString()); |
| + } |
| + super_type ^= type.raw(); |
| if (super_type.IsInterfaceType()) { |
| ErrorMsg("class '%s' may implement, but cannot extend interface '%s'", |
| class_name.ToCString(), |
| @@ -3004,6 +3010,17 @@ |
| for (intptr_t i = 0; i < interfaces.Length(); i++) { |
| AbstractType& interface = AbstractType::ZoneHandle(); |
| interface ^= interfaces.At(i); |
| + if (interface.IsTypeParameter()) { |
| + if (cls.is_interface()) { |
| + ErrorMsg("interface '%s' may not extend type parameter '%s'", |
|
hausner
2012/01/09 18:54:49
Would be nice if these error messages were pointin
regis
2012/01/09 19:19:30
We should definitely store the position in each ty
|
| + String::Handle(cls.Name()).ToCString(), |
| + String::Handle(interface.Name()).ToCString()); |
| + } else { |
| + ErrorMsg("class '%s' may not implement type parameter '%s'", |
| + String::Handle(cls.Name()).ToCString(), |
| + String::Handle(interface.Name()).ToCString()); |
| + } |
| + } |
| if (!ClassFinalizer::AddInterfaceIfUnique(&all_interfaces, |
| &interface, |
| &conflicting)) { |