| 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 0f7d0cdc3e3d07df89fb64f12f2731129e3ee0c4..37cece34f4e2c7ce670c5c89f68e8fde9b144429 100644
|
| --- a/pkg/analyzer/lib/src/generated/constant.dart
|
| +++ b/pkg/analyzer/lib/src/generated/constant.dart
|
| @@ -733,8 +733,21 @@ class ConstantValueComputer {
|
| [argumentValue.type, parameter.type]);
|
| }
|
| if (baseParameter.isInitializingFormal) {
|
| - FieldElement field = (baseParameter as FieldFormalParameterElement).field;
|
| + FieldElement field = (parameter as FieldFormalParameterElement).field;
|
| if (field != null) {
|
| + DartType fieldType = field.type;
|
| + if (fieldType != parameter.type) {
|
| + // We've already checked that the argument can be assigned to the
|
| + // parameter; we also need to check that it can be assigned to
|
| + // the field.
|
| + if (!argumentValue.isNull &&
|
| + !argumentValue.type.isSubtypeOf(fieldType)) {
|
| + errorReporter.reportErrorForNode(
|
| + CheckedModeCompileTimeErrorCode.CONST_CONSTRUCTOR_PARAM_TYPE_MISMATCH,
|
| + errorTarget,
|
| + [argumentValue.type, fieldType]);
|
| + }
|
| + }
|
| String fieldName = field.name;
|
| fieldMap[fieldName] = argumentValue;
|
| }
|
|
|