Skip to content

Commit f1219f2

Browse files
nshahanCommit Queue
authored and
Commit Queue
committed
[ddc] Make equality optimizations aware of
extension types. This ensures the same optimizations are applied to extension types and the representation type they are erased to. Issue: #49735 Change-Id: I630fc8b68e6e86b81ec85495286719ca39f89d14 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/335943 Reviewed-by: Mark Zhou <[email protected]>
1 parent 275aa86 commit f1219f2

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

pkg/dev_compiler/lib/src/kernel/compiler.dart

+3-2
Original file line numberDiff line numberDiff line change
@@ -6131,7 +6131,7 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
61316131
Expression left, Member? target, Expression right,
61326132
{bool negated = false}) {
61336133
var targetClass = target?.enclosingClass;
6134-
var leftType = left.getStaticType(_staticTypeContext);
6134+
var leftType = left.getStaticType(_staticTypeContext).extensionTypeErasure;
61356135

61366136
// Conceptually `x == y` in Dart is defined as:
61376137
//
@@ -6923,7 +6923,8 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
69236923
importUri.path == 'html_common');
69246924

69256925
bool _isNull(Expression expr) =>
6926-
expr is NullLiteral || expr.getStaticType(_staticTypeContext) is NullType;
6926+
expr is NullLiteral ||
6927+
expr.getStaticType(_staticTypeContext).extensionTypeErasure is NullType;
69276928

69286929
bool _doubleEqIsIdentity(Expression left, Expression right) {
69296930
// If we statically know LHS or RHS is null we can use ==.

0 commit comments

Comments
 (0)