Skip to content

Commit 9547628

Browse files
nshahancommit-bot@chromium.org
authored andcommitted
[ddc] Compare types with new DartTypeEquivalence
Avoids an assertion failure in the front end. Change-Id: I7994fa611f82011857750cc60af64a2c89c96bf7 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152923 Reviewed-by: Dmitry Stefantsov <[email protected]> Commit-Queue: Nicholas Shahan <[email protected]>
1 parent f42889f commit 9547628

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

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

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import 'package:kernel/kernel.dart' hide MapEntry;
1212
import 'package:kernel/library_index.dart';
1313
import 'package:kernel/type_algebra.dart';
1414
import 'package:kernel/type_environment.dart';
15+
import 'package:kernel/src/dart_type_equivalence.dart';
1516
import 'package:source_span/source_span.dart' show SourceLocation;
1617
import 'package:path/path.dart' as p;
1718

@@ -5331,7 +5332,8 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
53315332
}
53325333

53335334
if (!isTypeError &&
5334-
from.withDeclaredNullability(Nullability.nonNullable) == to &&
5335+
DartTypeEquivalence(_coreTypes, ignoreTopLevelNullability: true)
5336+
.areEqual(from, to) &&
53355337
_mustBeNonNullable(to)) {
53365338
// If the underlying type is the same, we only need a null check.
53375339
return runtimeCall('nullCast(#, #)', [jsFrom, _emitType(to)]);

0 commit comments

Comments
 (0)