From 624fc6a9d60c4551aeef361886424b7a306b1725 Mon Sep 17 00:00:00 2001 From: Nate Biggs Date: Thu, 9 Mar 2023 22:08:46 +0000 Subject: [PATCH] [dart2js] Remove as checks where the expression is known to be null and the cast type is nullable. Change-Id: I3f17a581d77bf4cfda90cf931c4bbdf0a53d0929 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286681 Commit-Queue: Nate Biggs Reviewed-by: Stephen Adams --- pkg/compiler/lib/src/ssa/nodes.dart | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pkg/compiler/lib/src/ssa/nodes.dart b/pkg/compiler/lib/src/ssa/nodes.dart index 1b27d2ca69d..76eb335fc50 100644 --- a/pkg/compiler/lib/src/ssa/nodes.dart +++ b/pkg/compiler/lib/src/ssa/nodes.dart @@ -4344,6 +4344,8 @@ AbstractBool _typeTest( if (expressionIsNull.isPotentiallyTrue) { if (dartType.isObject) return AbstractBool.Maybe; } + } else if (expressionIsNull.isDefinitelyTrue && _nullIs(dartType)) { + return AbstractBool.True; } if (checkedAbstractValue.isPrecise &&