Chromium Code Reviews| 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 f8cb97f6e8964224c15fbab6d0fdc2a9993c3bae..b599cdf173c0a92349c5e4d5fb7895341e06a4e6 100644 |
| --- a/pkg/analyzer/lib/src/task/strong_mode.dart |
| +++ b/pkg/analyzer/lib/src/task/strong_mode.dart |
| @@ -297,7 +297,11 @@ class InstanceMemberInferrer { |
| // Then, if none was found, infer the type from the initialization |
| // expression. |
| // |
| - if (newType == null) { |
| + // Also, if we're the field is final and overridden getter is dynamic, |
| + // we can infer from the initialization without breaking subtyping rules |
| + // (return type is covariant). |
| + // |
| + if (newType == null || newType.isDynamic) { |
|
Jennifer Messerly
2015/09/25 21:41:55
this fix is intended to match: https://github.com/
Brian Wilkerson
2015/09/25 22:00:00
hasImplicitType only applies to variables, not typ
Jennifer Messerly
2015/09/25 22:22:11
What doesn't make sense about the comment? That's
Leaf
2015/09/25 22:36:32
The comment has a wording problem in the first lin
Jennifer Messerly
2015/09/25 22:48:23
ah good catch. How about this:
Also infer from th
Brian Wilkerson
2015/09/26 00:36:29
Aside from the grammatical error, it seems to me t
Jennifer Messerly
2015/09/26 00:48:23
"if <condition>, do this" "also, if <other conditi
|
| if (fieldElement.initializer != null && |
| (fieldElement.isFinal || overriddenGetters.isEmpty)) { |
| newType = fieldElement.initializer.returnType; |