PyNeverType is no longer child of PyUnionType, it was confusing.
Fixed failing conformance tests
GitOrigin-RevId: d05a425fa02e1647b82017a74b669fa3e1518354
PySliceExpression is replaced by PySubscriptionExpression in AST.
PySliceItem is returned by PySubscriptionExpression.getIndexExpression(). For that purpose PySliceItem is now a PyExpression of type `builtins.slice`.
GitOrigin-RevId: 9aa8de13ef7c51741e248317c5264b3a06ffb9bf
Swap back to ConcurrentMap and add more Registry checks
softValueMap doesn't play well with assumeType. Imagine this: you compute type A and store it, then compute type B that depends on A. But since softValueMap uses soft references, A might get garbage-collected. If that happens, you can override A with assumeType, and now B is out of sync — it's still based on the old version of A.
This kind of issue is unlikely to show up in small, artificial examples, but it could easily become a problem in real-world projects, especially large ones. It breaks the assumption that if a type is in the map, then everything it depends on should still be there too.
fix after rebase
Added nullability annotations to the AssumptionContext constructor parameters to improve type safety.
dm-checkpoint-id: 1VH4Od1GtvAo
Squash for easier rebase
Co-authored-by: Space Team <noreply@jetbrains.team>
Merge-request: IJ-MR-146970
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>
GitOrigin-RevId: cf2fc232c2c5b35a037396b5f85be3129a5efd3a
It will allow moving the implementation of TypeEvalContext to intellij.python.psi.impl
as well, making more platform and Python plugin APIs available in it.
GitOrigin-RevId: c04a2dc4d892d213f5407bcce35aeb5a3aba42dc
PyKnownDecorator is now a class instead of an enum, allowing extension to create new instances
GitOrigin-RevId: 846617f68e559f7f77af15a999f837391ac3090e
Subtypes of types constrained by a type variable should be treated as their respective explicitly listed base types in the context of the type variable.
GitOrigin-RevId: ecaac1614f66974b6e6c2217ac0a90321d049f76
Infer typed dict type from TypedDict() call even in case of an unexpected arguments list.
Also changed incorrect TypedDict() signature:
from (name: str, fields: dict[str, Any], total: bool = True) -> Any
to (typename: str, fields: dict[str, type], *, /, total: bool = True) -> Any
GitOrigin-RevId: 94c1ebb4fe3026744cb9771eab9e5ba507d049fa
`PyTypeHintProvider` allows providing type hints for resolved elements before the main logic of `PyTypingTypeProvider`.
See an example of `django-stubs`: https://github.com/typeddjango/django-stubs/pull/2335.
`_UserModel` type might be replaced with a custom user model, provided in `settings.py` (`AUTH_USER_MODEL`).
GitOrigin-RevId: 986fb91c800be3ccfbc002c73c673896efec8a1a
Check YieldType of yield expressions in PyTypeCheckerInspection
Check that (Async)Generator is used in (async) function
Check that in 'yield from' sync Generator is used
Convert PyMakeFunctionReturnTypeQuickFix into PsiUpdateModCommandAction
Infer Generator type for lambdas
When getting function type from annotation, do not convert Generator to AsyncGenerator
Introduce GeneratorTypeDescriptor to simplify working with generator annotations
Merge-request: IJ-MR-146521
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>
GitOrigin-RevId: b3b8182168c5224f0e03f54d443171ccf6ca7b89
Updated PyFunction to account for implicit 'return None' statements when inferring return statement types.
It affected return type inference of PyFunction.
Fixed a failing test related to formatted strings.
Added a quick fix to make all return statements explicit.
Updated the CFG to include PyPassStatements, enabling detection of exit points in empty functions.
Simplified PyMakeFunctionReturnTypeQuickFix to independently infer function types and handle required imports. Currently, it does not support specifying custom suggested types.
Merge-request: IJ-MR-148719
Merged-by: Aleksandr Govenko <aleksandr.govenko@jetbrains.com>
GitOrigin-RevId: 9f58961f9eb70e4f9dbba7359f5aafdfd392b7e2
PyCallableParameterListType type represents a concrete list of PyCallableParameters that
a PyParamSpecType can be specialized with.
Now PyParamSpecType and PyCallableParameterListType are similar to PyTypeVarTupleType and
PyUnpackedTupleType (a type parameter and its concrete specialization).
PyCallableParameterVariadicType indicates types that PyParamSpecType can be specialized with.
Namely, another PyParamSpecType, PyCallableParameterListType and PyConcatenateType.
GitOrigin-RevId: cc254b64884e637c1200f6334b6680ea3444bb8a
that indicates types compatible with PyTypeVarTupleType: PyTypeVarTupleType and
PyUnpackedTupleType. It will allow introducing a counterpart interface for types
compatible with PyParamSpecType.
GitOrigin-RevId: 0d5c77dd21d2bc7a21b246cfbd951cdd096918e9
If there is an overload not followed by an implementation, which is
already an error, always resolve to the first overload, regardless
of whether it's a .py file, or a .pyi stub. It allows us to eliminate
the special RatedResolveResult#RATE_LIFTED_PY_FILE_OVERLOAD rate in .py
files, because we no longer need to duplicate the last, closest reachable
overload (normally an implementation should be reachable) with a higher
priority, and then filter it out during overload resolution.
Meanwhile, this filtering out didn't work right before
because some type inference logic, e.g., PyCallExpressionHelper.getCalleeType
used in PyReferenceExpressionImpl.getCallableType bypassed it. It should have
been done at the level of
PyCallExpressionHelper.forEveryScopeTakeOverloadsOtherwiseImplementations.
GitOrigin-RevId: 99a624ab85957d7a2d3c2c0ced596e472f9d615b