Skip to content

Commit

Permalink
Fix nullable Future.value and Completer.complete cases
Browse files Browse the repository at this point in the history
In these two cases, a nullable value is passed where a runtime error
will occur if the value is null. Make runtime check explicit.

Cleanup for #53253

Change-Id: Ia14bd345cbe20c50c75bdd2069f44449157bcc36
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/321423
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
  • Loading branch information
srawlins authored and Commit Queue committed Aug 17, 2023
1 parent a129675 commit 9f7de0d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pkg/analyzer/lib/src/dart/analysis/driver.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1134,7 +1134,7 @@ class AnalysisDriver implements AnalysisDriverGeneric {
if (_unitElementRequestedFiles.isNotEmpty) {
String path = _unitElementRequestedFiles.keys.first;
var completers = _unitElementRequestedFiles.remove(path)!;
final result = await _computeUnitElement(path);
final result = (await _computeUnitElement(path))!;
for (var completer in completers) {
completer.complete(result);
}
Expand Down
2 changes: 1 addition & 1 deletion pkg/front_end/lib/src/fasta/kernel/macro/macro.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1385,7 +1385,7 @@ class _DefinitionPhaseIntrospector extends _DeclarationPhaseIntrospector
@override
Future<macro.TypeAnnotation> inferType(
macro.OmittedTypeAnnotation omittedType) =>
new Future.value(macroApplications._inferOmittedType(omittedType));
new Future.value(macroApplications._inferOmittedType(omittedType)!);

@override
Future<List<macro.Declaration>> topLevelDeclarationsOf(
Expand Down

0 comments on commit 9f7de0d

Please sign in to comment.