From e7c590b137013384f4d8c780048329f1722e9206 Mon Sep 17 00:00:00 2001 From: Sam Rawlins Date: Fri, 21 Oct 2022 13:23:57 +0000 Subject: [PATCH] Make some bool fields in nullability_node non-nullable Change-Id: If50538f4e4c189d45af0a2c22e7a6a19a29c7f68 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265080 Auto-Submit: Samuel Rawlins Commit-Queue: Paul Berry Reviewed-by: Paul Berry --- pkg/nnbd_migration/lib/src/nullability_node.dart | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pkg/nnbd_migration/lib/src/nullability_node.dart b/pkg/nnbd_migration/lib/src/nullability_node.dart index f730d5314db..15b7b42f451 100644 --- a/pkg/nnbd_migration/lib/src/nullability_node.dart +++ b/pkg/nnbd_migration/lib/src/nullability_node.dart @@ -84,15 +84,17 @@ class NullabilityEdge implements EdgeInfo { final String description; /// Whether this edge is the result of an uninitialized variable declaration. - final bool? isUninit; + final bool isUninit; /// Whether this edge is the result of an assignment within the test package's /// `setUp` function. - final bool? isSetupAssignment; + final bool isSetupAssignment; NullabilityEdge._( this.destinationNode, this.upstreamNodes, this._kind, this.description, - {this.codeReference, this.isUninit, this.isSetupAssignment}); + {this.codeReference, + this.isUninit = false, + this.isSetupAssignment = false}); @override Iterable get guards => upstreamNodes.skip(1); @@ -964,11 +966,11 @@ class _PropagationState { var edge = step.edge; if (!edge.isTriggered) continue; var node = edge.destinationNode; - if (edge.isUninit! && !node.isNullable) { + if (edge.isUninit && !node.isNullable) { // [edge] is an edge from always to an uninitialized variable // declaration. var isSetupAssigned = node.upstreamEdges - .any((e) => e is NullabilityEdge && e.isSetupAssignment!); + .any((e) => e is NullabilityEdge && e.isSetupAssignment); // Whether all downstream edges go to nodes with non-null intent. var allDownstreamHaveNonNullIntent = false;