Skip to content

Commit 22d6cd6

Browse files
iinozemtsevCommit Queue
authored andcommitted
Log digests on digest mismatch state error
Also reformat to satisfy a presubmit check. Bug: 418755091 Change-Id: I5d7b85749a254ecd1b40de67ee62a2ce0e2e1f8b Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/441300 Commit-Queue: Ivan Inozemtsev <[email protected]> Auto-Submit: Ivan Inozemtsev <[email protected]> Reviewed-by: Konstantin Shcheglov <[email protected]>
1 parent aca53b2 commit 22d6cd6

File tree

1 file changed

+34
-34
lines changed

1 file changed

+34
-34
lines changed

pkg/analyzer/lib/src/dart/micro/resolve_file.dart

Lines changed: 34 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,11 @@ class CiderFileContent implements FileContent {
6060
var contentWithDigest = _getContent();
6161

6262
if (contentWithDigest.digestStr != digestStr) {
63-
throw StateError('File was changed, but not invalidated: $path');
63+
throw StateError(
64+
'File was changed, but not invalidated: $path. '
65+
'Expected digest: $digestStr.'
66+
'Actual digest: ${contentWithDigest.digestStr}',
67+
);
6468
}
6569

6670
return contentWithDigest.content;
@@ -330,10 +334,9 @@ class FileResolver {
330334
var bytes = _errorResultsCache.get(errorsKey);
331335
if (bytes != null) {
332336
var data = CiderUnitErrors.fromBuffer(bytes);
333-
diagnostics =
334-
data.errors.map((error) {
335-
return ErrorEncoding.decode(file.source, error)!;
336-
}).toList();
337+
diagnostics = data.errors.map((error) {
338+
return ErrorEncoding.decode(file.source, error)!;
339+
}).toList();
337340
} else {
338341
var unitResult = await resolve(path: path, performance: performance);
339342
diagnostics = unitResult.diagnostics;
@@ -652,16 +655,15 @@ class FileResolver {
652655
});
653656
});
654657

655-
var resolvedUnits =
656-
results.map((fileResult) {
657-
var file = fileResult.file;
658-
return ResolvedUnitResultImpl(
659-
session: contextObjects!.analysisSession,
660-
fileState: file,
661-
unit: fileResult.unit,
662-
diagnostics: fileResult.diagnostics,
663-
);
664-
}).toList();
658+
var resolvedUnits = results.map((fileResult) {
659+
var file = fileResult.file;
660+
return ResolvedUnitResultImpl(
661+
session: contextObjects!.analysisSession,
662+
fileState: file,
663+
unit: fileResult.unit,
664+
diagnostics: fileResult.diagnostics,
665+
);
666+
}).toList();
665667

666668
var libraryUnit = resolvedUnits.first;
667669
var result = ResolvedLibraryResultImpl(
@@ -694,13 +696,12 @@ class FileResolver {
694696
return;
695697
}
696698

697-
var analysisOptions =
698-
(AnalysisOptionsBuilder()
699-
..strictInference = fileAnalysisOptions.strictInference
700-
..contextFeatures =
701-
FeatureSet.latestLanguageVersion() as ExperimentStatus
702-
..nonPackageFeatureSet = FeatureSet.latestLanguageVersion())
703-
.build();
699+
var analysisOptions = (AnalysisOptionsBuilder()
700+
..strictInference = fileAnalysisOptions.strictInference
701+
..contextFeatures =
702+
FeatureSet.latestLanguageVersion() as ExperimentStatus
703+
..nonPackageFeatureSet = FeatureSet.latestLanguageVersion())
704+
.build();
704705

705706
if (fsState == null) {
706707
var featureSetProvider = FeatureSetProvider.build(
@@ -782,8 +783,8 @@ class FileResolver {
782783
YamlMap? optionMap;
783784

784785
var separator = resourceProvider.pathContext.separator;
785-
var isThirdParty =
786-
path.contains('${separator}third_party${separator}dart$separator') ||
786+
var isThirdParty = path
787+
.contains('${separator}third_party${separator}dart$separator') ||
787788
path.contains('${separator}third_party${separator}dart_lang$separator');
788789

789790
File? optionsFile;
@@ -881,16 +882,15 @@ class FileResolver {
881882
);
882883
unitResult.unit.accept(visitor);
883884
var lineInfo = unitResult.lineInfo;
884-
var infos =
885-
visitor.results
886-
.map(
887-
(searchResult) => CiderSearchInfo(
888-
lineInfo.getLocation(searchResult.offset),
889-
searchResult.length,
890-
MatchKind.REFERENCE,
891-
),
892-
)
893-
.toList();
885+
var infos = visitor.results
886+
.map(
887+
(searchResult) => CiderSearchInfo(
888+
lineInfo.getLocation(searchResult.offset),
889+
searchResult.length,
890+
MatchKind.REFERENCE,
891+
),
892+
)
893+
.toList();
894894
results.add(CiderSearchMatch(unitPath, infos));
895895
}
896896
return results;

0 commit comments

Comments
 (0)