@zzzen/pyright-internal 1.2.0-dev.20250330 → 1.2.0-dev.20250406

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.
@@ -4606,8 +4606,13 @@ class Checker extends parseTreeWalker_1.ParseTreeWalker {
4606
4606
  return;
4607
4607
  }
4608
4608
  const baseClass = baseClassAndSymbol.classType;
4609
- const baseClassSelf = types_1.ClassType.cloneAsInstance((0, typeUtils_1.selfSpecializeClass)(baseClass, { useBoundTypeVars: true }));
4610
4609
  const childClassSelf = types_1.ClassType.cloneAsInstance((0, typeUtils_1.selfSpecializeClass)(childClassType, { useBoundTypeVars: true }));
4610
+ // The "Self" value for the base class depends on whether it's a
4611
+ // protocol or not. It's not clear from the typing spec whether
4612
+ // this is the correct behavior.
4613
+ const baseClassSelf = types_1.ClassType.isProtocolClass(baseClass)
4614
+ ? childClassSelf
4615
+ : types_1.ClassType.cloneAsInstance((0, typeUtils_1.selfSpecializeClass)(baseClass, { useBoundTypeVars: true }));
4611
4616
  let baseType = (0, typeUtils_1.partiallySpecializeType)(this._evaluator.getEffectiveTypeOfSymbol(baseClassAndSymbol.symbol), baseClass, this._evaluator.getTypeClassType(), baseClassSelf);
4612
4617
  overrideType = (0, typeUtils_1.partiallySpecializeType)(overrideType, childClassType, this._evaluator.getTypeClassType(), childClassSelf);
4613
4618
  if (childClassType.shared.typeVarScopeId) {