| Index: runtime/vm/class_finalizer.cc
|
| ===================================================================
|
| --- runtime/vm/class_finalizer.cc (revision 13204)
|
| +++ runtime/vm/class_finalizer.cc (working copy)
|
| @@ -746,6 +746,16 @@
|
| type_argument = arguments.TypeAt(i);
|
| type_argument = FinalizeType(cls, type_argument, finalization);
|
| if (type_argument.IsMalformed()) {
|
| + // Malformed type arguments to a constructor of a generic type are
|
| + // reported as a compile-time error.
|
| + if (finalization >= kCanonicalizeForCreation) {
|
| + const Script& script = Script::Handle(cls.script());
|
| + const String& type_name =
|
| + String::Handle(parameterized_type.UserVisibleName());
|
| + ReportError(script, parameterized_type.token_pos(),
|
| + "type '%s' has malformed type argument",
|
| + type_name.ToCString());
|
| + }
|
| // In production mode, malformed type arguments are mapped to Dynamic.
|
| // In checked mode, a type with malformed type arguments is malformed.
|
| if (FLAG_enable_type_checks || FLAG_error_on_malformed_type) {
|
| @@ -775,6 +785,14 @@
|
| // However, type parameter bounds are checked below, even for a raw type.
|
| if (!arguments.IsNull() && (arguments.Length() != num_type_parameters)) {
|
| // Wrong number of type arguments. The type is malformed.
|
| + if (finalization >= kCanonicalizeForCreation) {
|
| + const Script& script = Script::Handle(cls.script());
|
| + const String& type_name =
|
| + String::Handle(parameterized_type.UserVisibleName());
|
| + ReportError(script, parameterized_type.token_pos(),
|
| + "wrong number of type arguments in type '%s'",
|
| + type_name.ToCString());
|
| + }
|
| FinalizeMalformedType(
|
| Error::Handle(), // No previous error.
|
| cls, parameterized_type, finalization,
|
|
|