PY-71002 PEP-696: Adapt the interfaces and implementations of Type Parameter types for the support of defaults

In particular:
- Add getters and setters for default types of Type Parameters
- Change the type of declaration elements for Type Parameters from hardcoded PyTargetExpression to PyQualifiedNameOwner to make it possible to set new-style Type Parameters as declaration elements
- Correctly calculate the qualified names of the new-style type alias statements as now they will be used in declaration elements of Type Parameters

GitOrigin-RevId: 5185d85c1a75052dfcb3f97c0eee17b52540d24b
This commit is contained in:
Daniil Kalinin
2024-08-29 12:01:34 +02:00
committed by intellij-monorepo-bot
parent 7751fceaed
commit dd328f3a60
8 changed files with 94 additions and 34 deletions

View File

@@ -11,7 +11,7 @@ import org.jetbrains.annotations.Nullable;
* Represents a Type Parameter that can be a part of {@link PyTypeParameterList}<br>
* For more information see <a href="https://peps.python.org/pep-0695/">PEP 695</a>
*/
public interface PyTypeParameter extends PyAstTypeParameter, PyElement, PsiNameIdentifierOwner, PyTypedElement, StubBasedPsiElement<PyTypeParameterStub> {
public interface PyTypeParameter extends PyAstTypeParameter, PyElement, PsiNameIdentifierOwner, PyTypedElement, PyQualifiedNameOwner, StubBasedPsiElement<PyTypeParameterStub> {
@Override
@Nullable

View File

@@ -79,4 +79,9 @@ public interface PyTypeParameterType extends PyType {
* Results of {@code getScopeOwner()} and {@link #getName()} constitute unique "coordinates" of a given type parameter.
*/
@Nullable PyQualifiedNameOwner getScopeOwner();
@Nullable
default PyType getDefaultType() {
return null;
}
}