PY-79067 Allow creating PyCallableType directly with PyCallableParameterVariadicType instead of wrapping it in the list of callable parameters

This refactoring allows simplifying and unifying logic whilst calculating substitutions for callable types and its matching in `PyTypeChecker`

GitOrigin-RevId: e61bd1f6cf19539b0a66ff2e3e47164aec0c0aa1
This commit is contained in:
Daniil Kalinin
2026-02-12 10:45:05 +00:00
committed by intellij-monorepo-bot
parent 5c277c03f8
commit 6e2c7614ca
12 changed files with 147 additions and 123 deletions
@@ -47,6 +47,21 @@ public interface PyCallableType extends PyType {
return null;
}
/**
* Returns the parameters type as a variadic type.
* This method provides a unified way to handle different forms of callable parameters:
* <ul>
* <li>{@link PyCallableParameterListType} for regular parameter lists</li>
* <li>{@link PyParamSpecType} for a single ParamSpec parameter type <code>Callable[P, R]</code></li>
* <li>{@link PyConcatenateType} for a single Concatenate type <code>Callable[Concatenate[T1, T2, P], R]</code></li>
* </ul>
* @return the parameters type, or null if not applicable
*/
@ApiStatus.Experimental
default @Nullable PyCallableParameterVariadicType getParametersType(@NotNull TypeEvalContext context) {
return null;
}
@Override
@Nullable
default String getName() {