Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(232)

Unified Diff: pkg/analyzer/lib/src/task/strong_mode.dart

Issue 2828573002: Fix for instance fields inference when a setter has no parameter. (Closed)
Patch Set: Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/top_level_inference_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 9208b991d3f082168a6397ad4d265a1ed727379c..e803d2df487c4b6dcb65b3e944076c980100d294 100644
--- a/pkg/analyzer/lib/src/task/strong_mode.dart
+++ b/pkg/analyzer/lib/src/task/strong_mode.dart
@@ -273,11 +273,14 @@ class InstanceMemberInferrer {
if (element.kind == ElementKind.GETTER) {
(element as ExecutableElementImpl).returnType = typeResult.type;
} else if (element.kind == ElementKind.SETTER) {
- var parameter = element.parameters[0] as ParameterElementImpl;
- if (parameter.hasImplicitType) {
- parameter.type = typeResult.type;
+ List<ParameterElement> parameters = element.parameters;
+ if (parameters.isNotEmpty) {
+ var parameter = parameters[0] as ParameterElementImpl;
+ if (parameter.hasImplicitType) {
+ parameter.type = typeResult.type;
+ }
+ parameter.inheritsCovariant = typeResult.isCovariant;
}
- parameter.inheritsCovariant = typeResult.isCovariant;
}
setFieldType(element.variable, typeResult.type);
}
« no previous file with comments | « no previous file | pkg/analyzer/test/src/summary/top_level_inference_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698