[dart2js] Revert invalid refinement change.

A user found another case where this fails (b/290868787).

In this case a ForwardingTypeMask is delegating the subtyping checks to its `forwardTo` mask which ends up saying the masks are equal even though the wrapper around the forwarded masks means they are not equal.

Change-Id: I015f2faf57557ff4189acb6c7144d09cf1ae6bb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/313341
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
Nate Biggs 2023-07-12 15:56:09 +00:00 committed by Commit Queue
parent d486c52ff6
commit 64fe77f8db
2 changed files with 14 additions and 3 deletions

View file

@ -786,9 +786,7 @@ class InferrerEngine {
// Check that refinement has not accidentally changed the type.
assert(oldType == info.type);
if (info.abandonInferencing) info.doNotEnqueue = true;
final invalidRefine =
abstractValueDomain.isInvalidRefinement(oldType, newType);
if (!invalidRefine && (info.type = newType) != oldType) {
if ((info.type = newType) != oldType) {
_overallRefineCount++;
info.incrementRefineCount();
if (info.refineCount > _MAX_CHANGE_COUNT) {

View file

@ -0,0 +1,13 @@
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file
// for details. All rights reserved. Use of this source code is governed by a
// BSD-style license that can be found in the LICENSE file.
double foo(List<double> l, [bool flag = false]) {
return flag ? l[0] * l[0] : 0;
}
void main() {
foo([1.0].toList(), true);
foo(List<double>.filled(1, 0.0));
foo([]);
}