Skip to content

Commit b1aed87

Browse files
scheglovCommit Queue
authored andcommitted
Fine. Always produce errors for changed files.
Change-Id: Ia9ba02fe660d54a91c4d36a1ba5c2661e8395633 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/453842 Reviewed-by: Johnni Winther <[email protected]> Commit-Queue: Konstantin Shcheglov <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
1 parent 0586239 commit b1aed87

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

pkg/analysis_server/test/analysis/update_content_test.dart

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,6 @@ void g() {
196196
// expect(filesErrors[b], isNull);
197197
}
198198

199-
@failingTest
200199
Future<void> test_sendNoticesAfterNopChange() async {
201200
// The errors are empty on the last line.
202201
addTestFile('');
@@ -221,7 +220,6 @@ void g() {
221220
expect(filesErrors, isNotEmpty);
222221
}
223222

224-
@failingTest
225223
Future<void> test_sendNoticesAfterNopChange_flushedUnit() async {
226224
// The list of errors is empty on the last line.
227225
addTestFile('');

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -656,6 +656,9 @@ class AnalysisDriver {
656656
return;
657657
}
658658
if (file_paths.isDart(resourceProvider.pathContext, path)) {
659+
var file = resourceProvider.getFile(path);
660+
_lastProducedSignatures.remove(path);
661+
_lastProducedDiagnosticIds.remove(file);
659662
_priorityResults.clear();
660663
_resolvedLibraryCache.clear();
661664
_pendingFileChanges.add(_FileChange(path, _FileChangeKind.change));

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

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94847,6 +94847,70 @@ typedef F<Y> = List<Y>;
9484794847
);
9484894848
}
9484994849

94850+
test_operation_addFile_change_sameContent() async {
94851+
configuration.withCheckLibraryDiagnosticsRequirements = true;
94852+
94853+
var driver = driverFor(testFile);
94854+
var collector = DriverEventCollector(driver, idProvider: idProvider);
94855+
94856+
newFile(testFile.path, r'''
94857+
void f() {}
94858+
''');
94859+
driver.addFile2(testFile);
94860+
94861+
await assertEventsText(collector, r'''
94862+
[status] working
94863+
[operation] analyzeFile
94864+
file: /home/test/lib/test.dart
94865+
library: /home/test/lib/test.dart
94866+
[stream]
94867+
ResolvedUnitResult #0
94868+
path: /home/test/lib/test.dart
94869+
uri: package:test/test.dart
94870+
flags: exists isLibrary
94871+
[operation] analyzedLibrary
94872+
file: /home/test/lib/test.dart
94873+
[status] idle
94874+
''');
94875+
94876+
// Notify about the file change.
94877+
// Even though no actual changes, we still get errors.
94878+
// See https://github.com/dart-lang/sdk/commit/ae2e608ff953eb511
94879+
driver.changeFile2(testFile);
94880+
await assertEventsText(collector, r'''
94881+
[status] working
94882+
[operation] reuseLinkedBundle
94883+
package:test/test.dart
94884+
[operation] getErrorsFromBytes
94885+
file: /home/test/lib/test.dart
94886+
library: /home/test/lib/test.dart
94887+
[stream]
94888+
ErrorsResult #1
94889+
path: /home/test/lib/test.dart
94890+
uri: package:test/test.dart
94891+
flags: isLibrary
94892+
[status] idle
94893+
''');
94894+
94895+
// Notify about the file change.
94896+
// Even though no actual changes, we still get errors.
94897+
driver.changeFile2(testFile);
94898+
await assertEventsText(collector, r'''
94899+
[status] working
94900+
[operation] reuseLinkedBundle
94901+
package:test/test.dart
94902+
[operation] getErrorsFromBytes
94903+
file: /home/test/lib/test.dart
94904+
library: /home/test/lib/test.dart
94905+
[stream]
94906+
ErrorsResult #2
94907+
path: /home/test/lib/test.dart
94908+
uri: package:test/test.dart
94909+
flags: isLibrary
94910+
[status] idle
94911+
''');
94912+
}
94913+
9485094914
test_operation_addFile_changeImported_affected() async {
9485194915
configuration.withCheckLibraryDiagnosticsRequirements = true;
9485294916

0 commit comments

Comments
 (0)