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

Unified Diff: pkg/analyzer/lib/src/generated/error_verifier.dart

Issue 1590533003: fix a nondeterministic error messsage by sorting the field names (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 11 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 | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/error_verifier.dart
diff --git a/pkg/analyzer/lib/src/generated/error_verifier.dart b/pkg/analyzer/lib/src/generated/error_verifier.dart
index d644fcdcde55a0109c6066f2a8a71779e50be3f7..b1ea8a35854bae54093abd0996cce2ea1f71f244 100644
--- a/pkg/analyzer/lib/src/generated/error_verifier.dart
+++ b/pkg/analyzer/lib/src/generated/error_verifier.dart
@@ -1288,24 +1288,23 @@ class ErrorVerifier extends RecursiveAstVisitor<Object> {
if (notInitFinalFields.isNotEmpty) {
foundError = true;
AnalysisErrorWithProperties analysisError;
- if (notInitFinalFields.length == 1) {
+ var names = notInitFinalFields.map((item) => item.name).toList();
Brian Wilkerson 2016/01/15 15:26:04 In non-test code, we type annotate everything.
skybrian 2016/01/15 22:48:06 Done.
+ names.sort();
+ if (names.length == 1) {
analysisError = _errorReporter.newErrorWithProperties(
StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_1,
constructor.returnType,
- [notInitFinalFields[0].name]);
+ names);
} else if (notInitFinalFields.length == 2) {
skybrian 2016/01/15 22:48:06 changed to names.length
analysisError = _errorReporter.newErrorWithProperties(
StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_2,
constructor.returnType,
- [notInitFinalFields[0].name, notInitFinalFields[1].name]);
+ names);
} else {
analysisError = _errorReporter.newErrorWithProperties(
StaticWarningCode.FINAL_NOT_INITIALIZED_CONSTRUCTOR_3_PLUS,
- constructor.returnType, [
- notInitFinalFields[0].name,
- notInitFinalFields[1].name,
- notInitFinalFields.length - 2
- ]);
+ constructor.returnType,
+ [names[0], names[1], names.length - 2]);
}
analysisError.setProperty(
ErrorProperty.NOT_INITIALIZED_FIELDS, notInitFinalFields);
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698