@@ -12981,6 +12981,17 @@ namespace ts {
12981
12981
return result;
12982
12982
}
12983
12983
12984
+ function propegateSidebandVarianceFlags(variances: VarianceFlags[]) {
12985
+ if (outofbandVarianceMarkerHandler) {
12986
+ if (some(variances, v => !!(v & VarianceFlags.Unmeasurable))) {
12987
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ false);
12988
+ }
12989
+ if (some(variances, v => !!(v & VarianceFlags.Unreliable))) {
12990
+ outofbandVarianceMarkerHandler(/*onlyUnreliable*/ true);
12991
+ }
12992
+ }
12993
+ }
12994
+
12984
12995
// Determine if possibly recursive types are related. First, check if the result is already available in the global cache.
12985
12996
// Second, check if we have already started a comparison of the given two types in which case we assume the result to be true.
12986
12997
// Third, check if both types are part of deeply nested chains of generic type instantiations and if so assume the types are
@@ -12998,6 +13009,16 @@ namespace ts {
12998
13009
// as a failure, and should be updated as a reported failure by the bottom of this function.
12999
13010
}
13000
13011
else {
13012
+ if (outofbandVarianceMarkerHandler) {
13013
+ // We're in the middle of variance checking - integrate any unmeasurable/unreliable flags from this cached component
13014
+ if (source.flags & (TypeFlags.Object | TypeFlags.Conditional) && source.aliasSymbol &&
13015
+ source.aliasTypeArguments && source.aliasSymbol === target.aliasSymbol) {
13016
+ propegateSidebandVarianceFlags(getAliasVariances(source.aliasSymbol));
13017
+ }
13018
+ if (getObjectFlags(source) & ObjectFlags.Reference && getObjectFlags(target) & ObjectFlags.Reference && (<TypeReference>source).target === (<TypeReference>target).target) {
13019
+ propegateSidebandVarianceFlags(getVariances((<TypeReference>source).target));
13020
+ }
13021
+ }
13001
13022
return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False;
13002
13023
}
13003
13024
}
0 commit comments