Skip to content

Commit 6f3f4b5

Browse files
srawlinsCommit Queue
authored and
Commit Queue
committed
Treat warnings more like hints (less like errors) in driver, fixes, and completions.
The presence of errors (and previously, warnings) affects what completions are offered (or their order?) and what fixes are offered (or their order?), and the order of re-analysis. When unused local variables and imports etc are WARNINGS, fixes, completions, and re-analysis should not regress. Bug: #50796 Change-Id: If5141eec7df01f50caee5bf245c031b5a51ea590 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291100 Reviewed-by: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]> Commit-Queue: Samuel Rawlins <[email protected]>
1 parent 6123ac7 commit 6f3f4b5

File tree

4 files changed

+6
-5
lines changed

4 files changed

+6
-5
lines changed

pkg/analysis_server/lib/src/services/completion/statement/statement_completion.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,7 @@ class StatementCompletionProcessor {
152152
}
153153
for (var error in statementContext.resolveResult.errors) {
154154
if (error.offset >= node.offset && error.offset <= node.end) {
155-
if (error.errorCode is! HintCode) {
155+
if (error.errorCode is! HintCode && error.errorCode is! WarningCode) {
156156
errors.add(error);
157157
}
158158
}

pkg/analysis_server/lib/src/services/correction/fix_internal.dart

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1739,7 +1739,9 @@ class FixProcessor extends BaseProcessor {
17391739
}
17401740
}
17411741

1742-
if (errorCode is LintCode || errorCode is HintCode) {
1742+
if (errorCode is LintCode ||
1743+
errorCode is HintCode ||
1744+
errorCode is WarningCode) {
17431745
var generators = [
17441746
IgnoreDiagnosticOnLine.new,
17451747
IgnoreDiagnosticInFile.new,

pkg/analyzer/lib/src/dart/analysis/driver.dart

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1904,8 +1904,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
19041904
FileState file, List<AnalysisError> errors) {
19051905
for (AnalysisError error in errors) {
19061906
ErrorSeverity severity = error.errorCode.errorSeverity;
1907-
if (severity == ErrorSeverity.ERROR ||
1908-
severity == ErrorSeverity.WARNING) {
1907+
if (severity == ErrorSeverity.ERROR) {
19091908
file.hasErrorOrWarning = true;
19101909
return;
19111910
}

pkg/analyzer/test/src/dart/analysis/driver_test.dart

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3308,7 +3308,7 @@ class F extends X {}
33083308

33093309
allResults.clear();
33103310

3311-
// Update a.dart with changing its API signature.
3311+
// Update b.dart with changing its API signature.
33123312
modifyFile(b, 'class A {}');
33133313
driver.changeFile(b);
33143314
await waitForIdleWithoutExceptions();

0 commit comments

Comments
 (0)