@@ -32553,17 +32553,6 @@ m2: ${(this.mapper2 as unknown as DebugTypeMapper).__debugToString().split("\n")
3255332553 }
3255432554 }
3255532555 }
32556- const restType = getEffectiveRestType(context);
32557- if (restType && restType.flags & TypeFlags.TypeParameter) {
32558- // The contextual signature has a generic rest parameter. We first instantiate the contextual
32559- // signature (without fixing type parameters) and assign types to contextually typed parameters.
32560- const instantiatedContext = instantiateSignature(context, inferenceContext.nonFixingMapper);
32561- assignContextualParameterTypes(signature, instantiatedContext);
32562- // We then infer from a tuple type representing the parameters that correspond to the contextual
32563- // rest parameter.
32564- const restPos = getParameterCount(context) - 1;
32565- inferTypes(inferenceContext.inferences, getRestTypeAtPosition(signature, restPos), restType);
32566- }
3256732556 }
3256832557
3256932558 function assignContextualParameterTypes(signature: Signature, context: Signature) {
@@ -33079,10 +33068,15 @@ m2: ${(this.mapper2 as unknown as DebugTypeMapper).__debugToString().split("\n")
3307933068 if (isContextSensitive(node)) {
3308033069 if (contextualSignature) {
3308133070 const inferenceContext = getInferenceContext(node);
33071+ let instantiatedContextualSignature: Signature | undefined;
3308233072 if (checkMode && checkMode & CheckMode.Inferential) {
3308333073 inferFromAnnotatedParameters(signature, contextualSignature, inferenceContext!);
33074+ const restType = getEffectiveRestType(contextualSignature);
33075+ if (restType && restType.flags & TypeFlags.TypeParameter) {
33076+ instantiatedContextualSignature = instantiateSignature(contextualSignature, inferenceContext!.nonFixingMapper);
33077+ }
3308433078 }
33085- const instantiatedContextualSignature = inferenceContext ?
33079+ instantiatedContextualSignature || = inferenceContext ?
3308633080 instantiateSignature(contextualSignature, inferenceContext.mapper) : contextualSignature;
3308733081 assignContextualParameterTypes(signature, instantiatedContextualSignature);
3308833082 }
0 commit comments