Skip to content

Commit ff83327

Browse files
committed
Remove convoluted code that attempts to re-fix type parameters
1 parent 10e1b54 commit ff83327

File tree

1 file changed

+6
-14
lines changed

1 file changed

+6
-14
lines changed

src/compiler/checker.ts

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -16693,23 +16693,18 @@ namespace ts {
1669316693

1669416694
const links = getNodeLinks(node);
1669516695
const type = getTypeOfSymbol(node.symbol);
16696-
const contextSensitive = isContextSensitive(node);
16697-
const mightFixTypeParameters = contextSensitive && checkMode === CheckMode.Inferential;
1669816696

1669916697
// 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)) {
1670316699
const contextualSignature = getContextualSignature(node);
1670416700
// If a type check is started at a function expression that is an argument of a function call, obtaining the
1670516701
// contextual type may recursively get back to here during overload resolution of the call. If so, we will have
1670616702
// already assigned contextual types.
16707-
const contextChecked = !!(links.flags & NodeCheckFlags.ContextChecked);
16708-
if (mightFixTypeParameters || !contextChecked) {
16703+
if (!(links.flags & NodeCheckFlags.ContextChecked)) {
1670916704
links.flags |= NodeCheckFlags.ContextChecked;
1671016705
if (contextualSignature) {
1671116706
const signature = getSignaturesOfType(type, SignatureKind.Call)[0];
16712-
if (contextSensitive) {
16707+
if (isContextSensitive(node)) {
1671316708
const contextualMapper = getContextualMapper(node);
1671416709
if (checkMode === CheckMode.Inferential) {
1671516710
inferFromAnnotatedParameters(signature, contextualSignature, contextualMapper);
@@ -16718,18 +16713,15 @@ namespace ts {
1671816713
contextualSignature : instantiateSignature(contextualSignature, contextualMapper);
1671916714
assignContextualParameterTypes(signature, instantiatedContextualSignature);
1672016715
}
16721-
if (mightFixTypeParameters || !node.type && !signature.resolvedReturnType) {
16716+
if (!node.type && !signature.resolvedReturnType) {
1672216717
const returnType = getReturnTypeFromBody(node, checkMode);
1672316718
if (!signature.resolvedReturnType) {
1672416719
signature.resolvedReturnType = returnType;
1672516720
}
1672616721
}
1672716722
}
16728-
16729-
if (!contextChecked) {
16730-
checkSignatureDeclaration(node);
16731-
checkNodeDeferred(node);
16732-
}
16723+
checkSignatureDeclaration(node);
16724+
checkNodeDeferred(node);
1673316725
}
1673416726
}
1673516727

0 commit comments

Comments
 (0)