mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 04:37:12 +00:00
[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 <dmitryas@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
parent
f42889fbb8
commit
9547628ecf
|
@ -12,6 +12,7 @@ import 'package:kernel/kernel.dart' hide MapEntry;
|
|||
import 'package:kernel/library_index.dart';
|
||||
import 'package:kernel/type_algebra.dart';
|
||||
import 'package:kernel/type_environment.dart';
|
||||
import 'package:kernel/src/dart_type_equivalence.dart';
|
||||
import 'package:source_span/source_span.dart' show SourceLocation;
|
||||
import 'package:path/path.dart' as p;
|
||||
|
||||
|
@ -5331,7 +5332,8 @@ class ProgramCompiler extends ComputeOnceConstantVisitor<js_ast.Expression>
|
|||
}
|
||||
|
||||
if (!isTypeError &&
|
||||
from.withDeclaredNullability(Nullability.nonNullable) == to &&
|
||||
DartTypeEquivalence(_coreTypes, ignoreTopLevelNullability: true)
|
||||
.areEqual(from, to) &&
|
||||
_mustBeNonNullable(to)) {
|
||||
// If the underlying type is the same, we only need a null check.
|
||||
return runtimeCall('nullCast(#, #)', [jsFrom, _emitType(to)]);
|
||||
|
|
Loading…
Reference in a new issue