Skip to content

Commit df72843

Browse files
Only restore elaboration stacks when reporting errors.
If we are doing speculative checking, we don't want to unconditionally clear out previous elaborations.
1 parent 5f8f518 commit df72843

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

src/compiler/checker.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5215,7 +5215,9 @@ namespace ts {
52155215
// Report constraint errors only if the constraint is not the empty object type
52165216
const reportConstraintErrors = reportErrors && constraint !== emptyObjectType;
52175217
if (result = isRelatedTo(constraint, target, reportConstraintErrors)) {
5218-
errorInfo = saveErrorInfo;
5218+
if (reportErrors) {
5219+
errorInfo = saveErrorInfo;
5220+
}
52195221
return result;
52205222
}
52215223
}
@@ -5236,7 +5238,9 @@ namespace ts {
52365238
// Report structural errors only if we haven't reported any errors yet
52375239
const reportStructuralErrors = reportErrors && errorInfo === saveErrorInfo;
52385240
if (result = objectTypeRelatedTo(apparentType, source, target, reportStructuralErrors)) {
5239-
errorInfo = saveErrorInfo;
5241+
if (reportErrors) {
5242+
errorInfo = saveErrorInfo;
5243+
}
52405244
return result;
52415245
}
52425246
}
@@ -5614,7 +5618,9 @@ namespace ts {
56145618
const related = signatureRelatedTo(s, t, shouldElaborateErrors);
56155619
if (related) {
56165620
result &= related;
5617-
errorInfo = saveErrorInfo;
5621+
if (reportErrors) {
5622+
errorInfo = saveErrorInfo;
5623+
}
56185624
continue outer;
56195625
}
56205626
shouldElaborateErrors = false;

0 commit comments

Comments
 (0)