From 168b89ee7194febd5a40afd00813630e84c237f4 Mon Sep 17 00:00:00 2001 From: Paul Berry Date: Fri, 22 Jan 2021 09:13:37 -0800 Subject: [PATCH] Remove workarounds now that type promotion accounts for local boolean variables. This change removes workarounds that were introduced prior to landing Dart language feature https://github.com/dart-lang/language/issues/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. --- lib/web_ui/lib/src/engine/html/surface.dart | 12 +----------- lib/web_ui/lib/src/engine/semantics/semantics.dart | 10 ---------- 2 files changed, 1 insertion(+), 21 deletions(-) diff --git a/lib/web_ui/lib/src/engine/html/surface.dart b/lib/web_ui/lib/src/engine/html/surface.dart index b01ecbde7fb..d1d816d29c4 100644 --- a/lib/web_ui/lib/src/engine/html/surface.dart +++ b/lib/web_ui/lib/src/engine/html/surface.dart @@ -1092,17 +1092,7 @@ abstract class PersistedContainerSurface extends PersistedSurface { for (int indexInOld = 0; indexInOld < oldChildCount; indexInOld += 1) { final PersistedSurface? oldChild = oldChildren[indexInOld]; final bool childAlreadyClaimed = oldChild == null; - // After https://github.com/dart-lang/language/issues/1274 is - // implemented, `oldChild` will be promoted to non-nullable on the RHS - // of the `||`, so we won't need to null check it (and it will cause a - // build failure to try to do so). Until then, we need to null check it - // in such a way that won't cause a build failure once the feature is - // implemented. We can do that by casting to `dynamic`, and then - // relying on the call to `canUpdateAsMatch` implicitly downcasting to - // PersistentSurface. - // TODO(paulberry): remove this workaround once the feature is - // implemented. - if (childAlreadyClaimed || !newChild.canUpdateAsMatch(oldChild as dynamic)) { + if (childAlreadyClaimed || !newChild.canUpdateAsMatch(oldChild)) { continue; } allMatches.add(_PersistedSurfaceMatch( diff --git a/lib/web_ui/lib/src/engine/semantics/semantics.dart b/lib/web_ui/lib/src/engine/semantics/semantics.dart index 7a3df9c5b76..36d05104066 100644 --- a/lib/web_ui/lib/src/engine/semantics/semantics.dart +++ b/lib/web_ui/lib/src/engine/semantics/semantics.dart @@ -875,16 +875,6 @@ class SemanticsObject { effectiveTransformIsIdentity = effectiveTransform.isIdentity(); } } else if (!hasIdentityTransform) { - // After https://github.com/dart-lang/language/issues/1274 is implemented, - // `transform` will be promoted to non-nullable so we won't need to null - // check it (and it will cause a build failure to try to do so). Until - // then, we need to null check it in such a way that won't cause a build - // failure once the feature is implemented. We can do that using an - // explicit "if" test. - // TODO(paulberry): remove this check once the feature is implemented. - if (transform == null) { // ignore: unnecessary_null_comparison - throw 'impossible'; - } effectiveTransform = Matrix4.fromFloat32List(transform); effectiveTransformIsIdentity = false; }