[ddc] Cleanup false assumption from subtype check
FutureOr<A> <: FutureOr<B> iff A <: B was proven to not always be true. Changing this to simply an optimization and no longer "if and only if". Change-Id: I46f228933df65a86c2c525a48f11b18397b7c48c Fixes: https://github.com/dart-lang/sdk/issues/38818 Fixes: https://github.com/dart-lang/sdk/issues/42326 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151325 Reviewed-by: Mark Zhou <markzipan@google.com> Commit-Queue: Nicholas Shahan <nshahan@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
62893f9b00
commit
07e2921287
@@ -1415,10 +1415,10 @@ bool _isSubtype(t1, t2, @notNull bool strictMode) => JS<bool>('!', '''(() => {
|
||||
let t1TypeArg = ${getGenericArgs(t1)}[0];
|
||||
if (${_isFutureOr(t2)}) {
|
||||
let t2TypeArg = ${getGenericArgs(t2)}[0];
|
||||
// FutureOr<A> <: FutureOr<B> iff A <: B
|
||||
// TODO(nshahan): Proven to not actually be true and needs cleanup.
|
||||
// https://github.com/dart-lang/sdk/issues/38818
|
||||
return $_isSubtype(t1TypeArg, t2TypeArg, $strictMode);
|
||||
// FutureOr<A> <: FutureOr<B> if A <: B
|
||||
if ($_isSubtype(t1TypeArg, t2TypeArg, $strictMode)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// given t1 is Future<A> | A, then:
|
||||
|
||||
@@ -1413,10 +1413,10 @@ bool _isSubtype(t1, t2, @notNull bool strictMode) => JS<bool>('!', '''(() => {
|
||||
let t1TypeArg = ${getGenericArgs(t1)}[0];
|
||||
if (${_isFutureOr(t2)}) {
|
||||
let t2TypeArg = ${getGenericArgs(t2)}[0];
|
||||
// FutureOr<A> <: FutureOr<B> iff A <: B
|
||||
// TODO(nshahan): Proven to not actually be true and needs cleanup.
|
||||
// https://github.com/dart-lang/sdk/issues/38818
|
||||
return $_isSubtype(t1TypeArg, t2TypeArg, $strictMode);
|
||||
// FutureOr<A> <: FutureOr<B> if A <: B
|
||||
if ($_isSubtype(t1TypeArg, t2TypeArg, $strictMode)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// given t1 is Future<A> | A, then:
|
||||
|
||||
Reference in New Issue
Block a user