Chromium Code Reviews| Index: sdk/lib/_internal/compiler/implementation/compile_time_constants.dart |
| diff --git a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart |
| index 975d4e510e16b9e3cf508dcee0246a52f3af35ec..0ac15099044b7911d906f218eff73773deb90479 100644 |
| --- a/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart |
| +++ b/sdk/lib/_internal/compiler/implementation/compile_time_constants.dart |
| @@ -133,7 +133,8 @@ class ConstantHandler extends CompilerTask { |
| && element.isField()) { |
|
ngeoffray
2012/11/30 12:00:40
Maybe try to have this method call potentiallyChec
Johnni Winther
2012/12/04 10:07:17
I found no clean way to refactor.
|
| DartType elementType = element.computeType(compiler); |
| DartType constantType = value.computeType(compiler); |
| - if (!constantSystem.isSubtype(compiler, constantType, elementType)) { |
| + if (elementType.isMalformed || constantType.isMalformed || |
| + !constantSystem.isSubtype(compiler, constantType, elementType)) { |
| if (isConst) { |
| MessageKind kind = MessageKind.NOT_ASSIGNABLE; |
| compiler.reportError(node, new CompileTimeConstantError( |
| @@ -713,7 +714,8 @@ class ConstructorEvaluator extends CompileTimeConstantEvaluator { |
| DartType constantType = constant.computeType(compiler); |
| // TODO(ngeoffray): Handle type parameters. |
| if (elementType.element.isTypeVariable()) return; |
| - if (!constantSystem.isSubtype(compiler, constantType, elementType)) { |
| + if (elementType.isMalformed || constantType.isMalformed || |
| + !constantSystem.isSubtype(compiler, constantType, elementType)) { |
| MessageKind kind = MessageKind.NOT_ASSIGNABLE; |
| compiler.reportError(node, new CompileTimeConstantError( |
| kind, [elementType, constantType])); |