@@ -16693,23 +16693,18 @@ namespace ts {
16693
16693
16694
16694
const links = getNodeLinks(node);
16695
16695
const type = getTypeOfSymbol(node.symbol);
16696
- const contextSensitive = isContextSensitive(node);
16697
- const mightFixTypeParameters = contextSensitive && checkMode === CheckMode.Inferential;
16698
16696
16699
16697
// Check if function expression is contextually typed and assign parameter types if so.
16700
- // See the comment in assignTypeToParameterAndFixTypeParameters to understand why we need to
16701
- // check mightFixTypeParameters.
16702
- if (mightFixTypeParameters || !(links.flags & NodeCheckFlags.ContextChecked)) {
16698
+ if (!(links.flags & NodeCheckFlags.ContextChecked)) {
16703
16699
const contextualSignature = getContextualSignature(node);
16704
16700
// If a type check is started at a function expression that is an argument of a function call, obtaining the
16705
16701
// contextual type may recursively get back to here during overload resolution of the call. If so, we will have
16706
16702
// already assigned contextual types.
16707
- const contextChecked = !!(links.flags & NodeCheckFlags.ContextChecked);
16708
- if (mightFixTypeParameters || !contextChecked) {
16703
+ if (!(links.flags & NodeCheckFlags.ContextChecked)) {
16709
16704
links.flags |= NodeCheckFlags.ContextChecked;
16710
16705
if (contextualSignature) {
16711
16706
const signature = getSignaturesOfType(type, SignatureKind.Call)[0];
16712
- if (contextSensitive ) {
16707
+ if (isContextSensitive(node) ) {
16713
16708
const contextualMapper = getContextualMapper(node);
16714
16709
if (checkMode === CheckMode.Inferential) {
16715
16710
inferFromAnnotatedParameters(signature, contextualSignature, contextualMapper);
@@ -16718,18 +16713,15 @@ namespace ts {
16718
16713
contextualSignature : instantiateSignature(contextualSignature, contextualMapper);
16719
16714
assignContextualParameterTypes(signature, instantiatedContextualSignature);
16720
16715
}
16721
- if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) {
16716
+ if (!node.type && !signature.resolvedReturnType) {
16722
16717
const returnType = getReturnTypeFromBody(node, checkMode);
16723
16718
if (!signature.resolvedReturnType) {
16724
16719
signature.resolvedReturnType = returnType;
16725
16720
}
16726
16721
}
16727
16722
}
16728
-
16729
- if (!contextChecked) {
16730
- checkSignatureDeclaration(node);
16731
- checkNodeDeferred(node);
16732
- }
16723
+ checkSignatureDeclaration(node);
16724
+ checkNodeDeferred(node);
16733
16725
}
16734
16726
}
16735
16727
0 commit comments