Chromium Code Reviews| Index: pkg/analyzer/lib/src/generated/constant.dart |
| diff --git a/pkg/analyzer/lib/src/generated/constant.dart b/pkg/analyzer/lib/src/generated/constant.dart |
| index 8c1720693f5b9daea258a4206324362765433f12..d47db7daaf6125ff5af6684f9e86da752f15333a 100644 |
| --- a/pkg/analyzer/lib/src/generated/constant.dart |
| +++ b/pkg/analyzer/lib/src/generated/constant.dart |
| @@ -775,6 +775,14 @@ class ConstantValueComputer { |
| if (evaluationResult != null) { |
| String fieldName = constructorFieldInitializer.fieldName.name; |
| fieldMap[fieldName] = evaluationResult; |
| + PropertyAccessorElement getter = definingClass.getGetter(fieldName); |
|
Brian Wilkerson
2014/10/12 20:20:42
Seems like we should need to check for "getter !=
Paul Berry
2014/10/13 15:55:33
That's a good point. I'll add tests for these cas
|
| + PropertyInducingElement field = getter.variable; |
| + if (!evaluationResult.isNull && |
| + !evaluationResult.type.isSubtypeOf(field.type)) { |
| + errorReporter.reportErrorForNode( |
| + CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_FIELD_TYPE_MISMATCH, |
| + node, [evaluationResult.type, fieldName, field.type]); |
| + } |
| } |
| } else if (initializer is SuperConstructorInvocation) { |
| SuperConstructorInvocation superConstructorInvocation = initializer; |