Index: pkg/analyzer/lib/src/task/strong_mode.dart |
diff --git a/pkg/analyzer/lib/src/task/strong_mode.dart b/pkg/analyzer/lib/src/task/strong_mode.dart |
index a1fe104e11b64c0f2f8b570219435fc8afbb3507..dcc55f1840e7ebb86320a533767f669030ae27f6 100644 |
--- a/pkg/analyzer/lib/src/task/strong_mode.dart |
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart |
@@ -114,25 +114,27 @@ class InstanceMemberInferrer { |
} |
/** |
- * Compute the inferred type for the given property accessor [element]. The |
- * returned value is never `null`, but might be an error, and/or have the |
- * `null` type. |
+ * Compute the inferred type for the given property [accessor]. The returned |
+ * value is never `null`, but might be an error, and/or have the `null` type. |
*/ |
_FieldOverrideInferenceResult _computeFieldOverrideType( |
- ExecutableElement element) { |
- String name = element.displayName; |
+ PropertyAccessorElement accessor) { |
+ String name = accessor.displayName; |
var overriddenElements = <ExecutableElement>[]; |
overriddenElements.addAll( |
- inheritanceManager.lookupOverrides(element.enclosingElement, name)); |
- overriddenElements.addAll( |
- inheritanceManager.lookupOverrides(element.enclosingElement, '$name=')); |
+ inheritanceManager.lookupOverrides(accessor.enclosingElement, name)); |
+ if (overriddenElements.isEmpty || !accessor.variable.isFinal) { |
+ List<ExecutableElement> overriddenSetters = inheritanceManager |
+ .lookupOverrides(accessor.enclosingElement, '$name='); |
+ overriddenElements.addAll(overriddenSetters); |
+ } |
bool isCovariant = false; |
DartType impliedType; |
for (ExecutableElement overriddenElement in overriddenElements) { |
FunctionType overriddenType = |
- _toOverriddenFunctionType(element, overriddenElement); |
+ _toOverriddenFunctionType(accessor, overriddenElement); |
if (overriddenType == null) { |
return new _FieldOverrideInferenceResult(false, null, true); |
} |