mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-01-08 23:39:39 +07:00
Previously, we parameterized it in PyReferenceExpressionImpl#getTypeFromTarget
and PyFunctionImpl#analyzeCallType, but this substitution disregarded default types
and substituted free type parameters only with their bounds if those were present,
additionally diluting them with `Any` through a "weak type".
So if we had something like the following:
```
class Ref[T : str = str]:
def get_self(self) -> Self: ...
def get_type_param(self) -> T: ...
x: Ref = ...
x.get_self() # Ref[str | Any]
x.get_type_param() # str | Any
```
it worked somewhat correctly only if the omitted type parameter had a bound
in addition to the default.
One notable example from the standard library is the `open()` builtin
returning `TextIOWrapper` that has a default type parameter `_WrappedBuffer`.
This type parameter ended up either substituted with a "weak type" `_WrappedBuffer | Any`
or completely erased.
This change allowed removing special-casing for Self in PyFunctionImpl#analyzeCallType.
GitOrigin-RevId: 6408d24186bf607a08006f15b380e1eb158e63eb