File tree Expand file tree Collapse file tree 3 files changed +16
-2
lines changed
dev_compiler/lib/src/kernel
front_end/lib/src/fasta/source Expand file tree Collapse file tree 3 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -2792,6 +2792,20 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
27922792 // FutureOr<T?>? --> FutureOr<T?>
27932793 return futureOr.withDeclaredNullability (Nullability .nonNullable);
27942794 }
2795+ // The following is not part of the normalization spec but this is a
2796+ // convenient place to perform this change of nullability consistently. This
2797+ // only applies at compile-time and is not needed in the runtime version of
2798+ // the FutureOr normalization.
2799+ // FutureOr<T%>% --> FutureOr<T%>
2800+ //
2801+ // If the type argument has undetermined nullability the CFE propagates
2802+ // it to the FutureOr type as well. In this case we can represent the
2803+ // FutureOr type without any nullability wrappers and rely on the runtime to
2804+ // handle the nullability of the instantiated type appropriately.
2805+ if (futureOr.nullability == Nullability .undetermined &&
2806+ typeArgument.nullability == Nullability .undetermined) {
2807+ return futureOr.withDeclaredNullability (Nullability .nonNullable);
2808+ }
27952809 return futureOr;
27962810 }
27972811
Original file line number Diff line number Diff line change @@ -3577,7 +3577,7 @@ class SourceLibraryBuilder extends LibraryBuilderImpl {
35773577 // limitation of Kernel.
35783578 if (typeParameter != null &&
35793579 typeParameter.fileOffset != - 1 &&
3580- typeParameter.parent != null ) {
3580+ typeParameter.location != null ) {
35813581 // It looks like when parameters come from patch files, they don't
35823582 // have a reportable location.
35833583 (context ?? = < LocatedMessage > []).add (
Original file line number Diff line number Diff line change @@ -28,4 +28,4 @@ MAJOR 2
2828MINOR 14
2929PATCH 0
3030PRERELEASE 188
31- PRERELEASE_PATCH 1
31+ PRERELEASE_PATCH 3
You can’t perform that action at this time.
0 commit comments