From bd6e3733a70631cf4f6785bd67d841ade0371dd7 Mon Sep 17 00:00:00 2001 From: Robert Nystrom Date: Tue, 26 May 2020 18:24:20 +0000 Subject: [PATCH] Include warnings in the static error updater tool. A while back, we changed the test runner to validate warnings in static error tests, so this gets the updater tool to parity with that. Also, when printing analyzer errors, sort them by location before severity. Change-Id: Ia07e79adb6d7ca19a50210a2813d7f2f7e60f7e1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/148285 Auto-Submit: Bob Nystrom Reviewed-by: Leaf Petersen Commit-Queue: Bob Nystrom --- pkg/test_runner/lib/src/command_output.dart | 2 +- pkg/test_runner/tool/update_static_error_tests.dart | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/pkg/test_runner/lib/src/command_output.dart b/pkg/test_runner/lib/src/command_output.dart index 6eec3f28256..eb548077df4 100644 --- a/pkg/test_runner/lib/src/command_output.dart +++ b/pkg/test_runner/lib/src/command_output.dart @@ -536,11 +536,11 @@ class AnalyzerError implements Comparable { @override int compareTo(AnalyzerError other) { - if (severity != other.severity) return severity.compareTo(other.severity); if (file != other.file) return file.compareTo(other.file); if (line != other.line) return line.compareTo(other.line); if (column != other.column) return column.compareTo(other.column); if (length != other.length) return length.compareTo(other.length); + if (severity != other.severity) return severity.compareTo(other.severity); if (errorCode != other.errorCode) { return errorCode.compareTo(other.errorCode); } diff --git a/pkg/test_runner/tool/update_static_error_tests.dart b/pkg/test_runner/tool/update_static_error_tests.dart index fcdd01d6473..a8017d7d307 100644 --- a/pkg/test_runner/tool/update_static_error_tests.dart +++ b/pkg/test_runner/tool/update_static_error_tests.dart @@ -223,8 +223,9 @@ Future> runAnalyzer(String path, List options) async { } var errors = []; - AnalysisCommandOutput.parseErrors(result.stderr as String, errors); - return errors; + var warnings = []; + AnalysisCommandOutput.parseErrors(result.stderr as String, errors, warnings); + return [...errors, ...warnings]; } /// Invoke CFE on [path] and gather all static errors it reports.