mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-04-19 04:51:24 +07:00
PY-77538 Introduce PyCallableParameterListType and PyCallableParameterVariadicType interface
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
This commit is contained in:
committed by
intellij-monorepo-bot
parent
816845add5
commit
b0bb5138f7
@@ -0,0 +1,16 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.psi.types;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* Represents a series of {@link PyCallableParameter} used either as a part of {@link PyCallableType} or a substitution
|
||||
* for {@link PyParamSpecType}.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public interface PyCallableParameterListType extends PyCallableParameterVariadicType {
|
||||
@NotNull List<PyCallableParameter> getParameters();
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
// Copyright 2000-2024 JetBrains s.r.o. and contributors. Use of this source code is governed by the Apache 2.0 license.
|
||||
package com.jetbrains.python.psi.types;
|
||||
|
||||
import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
/**
|
||||
* Represents an entity in the type system that stands for a parameter list of a callable type.
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public non-sealed interface PyCallableParameterVariadicType extends PyVariadicType {
|
||||
}
|
||||
@@ -5,6 +5,9 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
|
||||
|
||||
/**
|
||||
* A type representing an ordered series of other types.
|
||||
* It can appear only as a type parameter/argument of another generic type.
|
||||
* <p>
|
||||
* Two variants of such types described in <a href="https://peps.python.org/pep-0646/">PEP 646 – Variadic Generics</a> are
|
||||
* TypeVarTuples and unpacked tuple types.
|
||||
*
|
||||
@@ -12,6 +15,6 @@ import org.jetbrains.annotations.ApiStatus;
|
||||
* @see PyUnpackedTupleType
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public interface PyPositionalVariadicType extends PyVariadicType {
|
||||
public sealed interface PyPositionalVariadicType extends PyVariadicType permits PyTypeVarTupleType, PyUnpackedTupleType {
|
||||
|
||||
}
|
||||
|
||||
@@ -23,5 +23,5 @@ package com.jetbrains.python.psi.types;
|
||||
* @see <a href="https://peps.python.org/pep-0646/#type-variable-tuples">PEP 646 – Variadic Generics</a>
|
||||
* @see PyUnpackedTupleType
|
||||
*/
|
||||
public interface PyTypeVarTupleType extends PyTypeParameterType, PyPositionalVariadicType {
|
||||
public non-sealed interface PyTypeVarTupleType extends PyTypeParameterType, PyPositionalVariadicType {
|
||||
}
|
||||
|
||||
@@ -17,7 +17,7 @@ import java.util.List;
|
||||
* @see <a href="https://peps.python.org/pep-0646/#unpacking-tuple-types">PEP 646 – Variadic Generics</a>
|
||||
* @see PyTypeVarTupleType
|
||||
*/
|
||||
public interface PyUnpackedTupleType extends PyPositionalVariadicType {
|
||||
public non-sealed interface PyUnpackedTupleType extends PyPositionalVariadicType {
|
||||
/**
|
||||
* Returns types contained inside this unpacked tuple type.
|
||||
* <p>
|
||||
|
||||
@@ -22,7 +22,7 @@ import java.util.List;
|
||||
* @see PyPositionalVariadicType
|
||||
*/
|
||||
@ApiStatus.Experimental
|
||||
public interface PyVariadicType extends PyType {
|
||||
public sealed interface PyVariadicType extends PyType permits PyPositionalVariadicType, PyCallableParameterVariadicType {
|
||||
@Override
|
||||
default boolean isBuiltin() {
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user