Throw a type error in production mode when the type of the type test is not

declared (issue 2571).
Add test.
Delete bad negative test now covered by new test.
Update status files of different compilers.
Review URL: https://chromiumcodereview.appspot.com//10035058

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@6754 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
regis@google.com
2012-04-19 17:01:28 +00:00
parent 3e370fe74e
commit f955de9bc0
8 changed files with 111 additions and 33 deletions
+9 -2
View File
@@ -3166,11 +3166,16 @@ RawAbstractTypeArguments* Parser::ParseTypeArguments(
do {
ConsumeToken();
type = ParseType(finalization);
types.Add(type);
// Only keep the error for the first malformed type argument.
if (malformed_error->IsNull() && type.IsMalformed()) {
*malformed_error = type.malformed_error();
}
// Map a malformed type argument to Dynamic, so that malformed types with
// a resolved type class are handled properly in production mode.
if (type.IsMalformed()) {
type = Type::DynamicType();
}
types.Add(type);
} while (CurrentToken() == Token::kCOMMA);
Token::Kind token = CurrentToken();
if ((token == Token::kGT) || (token == Token::kSHR)) {
@@ -7217,7 +7222,9 @@ RawAbstractType* Parser::ParseType(
}
AbstractType& type = AbstractType::Handle(
Type::New(type_class, type_arguments, type_name.ident_pos));
if (!malformed_error.IsNull()) {
// 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 && !malformed_error.IsNull()) {
Type& parameterized_type = Type::Handle();
parameterized_type ^= type.raw();
parameterized_type.set_type_class(Class::Handle(Object::dynamic_class()));