Skip to content

Commit 6dec57f

Browse files
Remove workarounds now that type promotion accounts for local boolean variables. (flutter#23862)
This change removes workarounds that were introduced prior to landing Dart language feature dart-lang/language#1274, which allows type promotion in null safe code to account for local boolean variables. The workarounds ensured that the code would analyze the same regardless of whether the feature was enabled, allowing for a smoother transition. Now that the feature has fully landed, the workarounds aren't needed anymore.
1 parent 31ef1dd commit 6dec57f

File tree

2 files changed

+1
-21
lines changed

2 files changed

+1
-21
lines changed

lib/web_ui/lib/src/engine/html/surface.dart

Lines changed: 1 addition & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1092,17 +1092,7 @@ abstract class PersistedContainerSurface extends PersistedSurface {
10921092
for (int indexInOld = 0; indexInOld < oldChildCount; indexInOld += 1) {
10931093
final PersistedSurface? oldChild = oldChildren[indexInOld];
10941094
final bool childAlreadyClaimed = oldChild == null;
1095-
// After https://github.com/dart-lang/language/issues/1274 is
1096-
// implemented, `oldChild` will be promoted to non-nullable on the RHS
1097-
// of the `||`, so we won't need to null check it (and it will cause a
1098-
// build failure to try to do so). Until then, we need to null check it
1099-
// in such a way that won't cause a build failure once the feature is
1100-
// implemented. We can do that by casting to `dynamic`, and then
1101-
// relying on the call to `canUpdateAsMatch` implicitly downcasting to
1102-
// PersistentSurface.
1103-
// TODO(paulberry): remove this workaround once the feature is
1104-
// implemented.
1105-
if (childAlreadyClaimed || !newChild.canUpdateAsMatch(oldChild as dynamic)) {
1095+
if (childAlreadyClaimed || !newChild.canUpdateAsMatch(oldChild)) {
11061096
continue;
11071097
}
11081098
allMatches.add(_PersistedSurfaceMatch(

lib/web_ui/lib/src/engine/semantics/semantics.dart

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -875,16 +875,6 @@ class SemanticsObject {
875875
effectiveTransformIsIdentity = effectiveTransform.isIdentity();
876876
}
877877
} else if (!hasIdentityTransform) {
878-
// After https://github.com/dart-lang/language/issues/1274 is implemented,
879-
// `transform` will be promoted to non-nullable so we won't need to null
880-
// check it (and it will cause a build failure to try to do so). Until
881-
// then, we need to null check it in such a way that won't cause a build
882-
// failure once the feature is implemented. We can do that using an
883-
// explicit "if" test.
884-
// TODO(paulberry): remove this check once the feature is implemented.
885-
if (transform == null) { // ignore: unnecessary_null_comparison
886-
throw 'impossible';
887-
}
888878
effectiveTransform = Matrix4.fromFloat32List(transform);
889879
effectiveTransformIsIdentity = false;
890880
}

0 commit comments

Comments
 (0)