Update relation cache after we decide to elaborate an error

This commit is contained in:
Anders Hejlsberg 2015-11-23 13:09:50 -08:00
parent fbaba90ac9
commit 4beedcf4c7

View file

@ -5228,9 +5228,12 @@ namespace ts {
const id = relation !== identityRelation || apparentSource.id < target.id ? apparentSource.id + "," + target.id : target.id + "," + apparentSource.id;
const related = relation[id];
if (related !== undefined) {
// If we computed this relation already and it was failed and reported, or if we're not being asked to elaborate
// errors, we can use the cached value. Otherwise, recompute the relation
if (!elaborateErrors || (related === RelationComparisonResult.FailedAndReported)) {
if (elaborateErrors && related === RelationComparisonResult.Failed) {
// We are elaborating errors and the cached result is an unreported failure. Record the result as a reported
// failure and continue computing the relation such that errors get reported.
relation[id] = RelationComparisonResult.FailedAndReported;
}
else {
return related === RelationComparisonResult.Succeeded ? Ternary.True : Ternary.False;
}
}