| Index: pkg/compiler/lib/src/resolution/resolution.dart
|
| diff --git a/pkg/compiler/lib/src/resolution/resolution.dart b/pkg/compiler/lib/src/resolution/resolution.dart
|
| index 4ea5aff5f2d2f4ce57e97c9e7f00869d71971da0..ea20e3b1fdac15f01393938b689a9452879aa201 100644
|
| --- a/pkg/compiler/lib/src/resolution/resolution.dart
|
| +++ b/pkg/compiler/lib/src/resolution/resolution.dart
|
| @@ -359,8 +359,21 @@ class ResolverTask extends CompilerTask {
|
| // TODO(johnniwinther): Share the resolved type between all variables
|
| // declared in the same declaration.
|
| if (tree.type != null) {
|
| - element.variables.type = visitor.resolveTypeAnnotation(tree.type);
|
| - } else {
|
| + DartType type = visitor.resolveTypeAnnotation(tree.type);
|
| + assert(invariant(
|
| + element,
|
| + element.variables.type == null ||
|
| + // Crude check but we have no equivalence relation that
|
| + // equates malformed types, like matching creations of type
|
| + // `Foo<Unresolved>`.
|
| + element.variables.type.toString() == type.toString(),
|
| + message: "Unexpected type computed for $element. "
|
| + "Was ${element.variables.type}, computed $type."));
|
| + element.variables.type = type;
|
| + } else if (element.variables.type == null) {
|
| + // Only assign the dynamic type if the element has no known type. This
|
| + // happens for enum fields where the type is known but is not in the
|
| + // synthesized AST.
|
| element.variables.type = const DynamicType();
|
| }
|
|
|
|
|