@zzzen/pyright-internal 1.2.0-dev.20251130 → 1.2.0-dev.20251221

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -8774,10 +8774,22 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8774
8774
  const matchResults = matchArgsToParams(errorNode, argList, typeResult, 0);
8775
8775
  if (matchResults.argumentErrors) {
8776
8776
  // Evaluate types of all args. This will ensure that referenced symbols are
8777
- // not reported as unaccessed.
8777
+ // not reported as unaccessed. Also pass the expected parameter type as
8778
+ // inference context to enable proper completions even when there are errors.
8779
+ matchResults.argParams.forEach((argParam) => {
8780
+ if (argParam.argument.valueExpression && !isSpeculativeModeInUse(argParam.argument.valueExpression)) {
8781
+ getTypeOfExpression(argParam.argument.valueExpression,
8782
+ /* flags */ undefined, (0, typeUtils_1.makeInferenceContext)(argParam.paramType));
8783
+ }
8784
+ });
8785
+ // Also evaluate any arguments that weren't matched to parameters
8778
8786
  argList.forEach((arg) => {
8779
8787
  if (arg.valueExpression && !isSpeculativeModeInUse(arg.valueExpression)) {
8780
- getTypeOfExpression(arg.valueExpression);
8788
+ // Check if this argument was already evaluated above
8789
+ const wasEvaluated = matchResults.argParams.some((argParam) => argParam.argument === arg);
8790
+ if (!wasEvaluated) {
8791
+ getTypeOfExpression(arg.valueExpression);
8792
+ }
8781
8793
  }
8782
8794
  });
8783
8795
  // Use a return type of Unknown but attach a "possible type" to it
@@ -8966,7 +8978,7 @@ function createTypeEvaluator(importLookup, evaluatorOptions, wrapWithLogger) {
8966
8978
  argType = argParam.argType;
8967
8979
  }
8968
8980
  else {
8969
- const argTypeResult = getTypeOfArg(argParam.argument, /* inferenceContext */ undefined);
8981
+ const argTypeResult = getTypeOfArg(argParam.argument, (0, typeUtils_1.makeInferenceContext)(argParam.paramType, isTypeIncomplete));
8970
8982
  argType = argTypeResult.type;
8971
8983
  if (argTypeResult.isIncomplete) {
8972
8984
  isTypeIncomplete = true;