PY-71002 PEP-696: Support new syntax for default types of Type Parameters in new-style declarations

- PEP-696 adds a new syntax for declaring the default types of Type Parameters in new-new style generic classes, functions and type alias statements. Support these grammar changes.
- Store info about default types in stubs for Type Parameters
- Increment the stub version counter in PyFileElementType

GitOrigin-RevId: b6b22e3eaa86ce06132885781e5775a89bf4b840
This commit is contained in:
Daniil Kalinin
2024-09-07 11:11:12 +00:00
committed by intellij-monorepo-bot
parent d73bf77d9a
commit 7751fceaed
30 changed files with 393 additions and 23 deletions
@@ -12,9 +12,16 @@ import org.jetbrains.annotations.Nullable;
* 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> {
@Override
@Nullable
default PyExpression getBoundExpression() {
return (PyExpression)PyAstTypeParameter.super.getBoundExpression();
}
@Override
@Nullable
default PyExpression getDefaultExpression() {
return (PyExpression)PyAstTypeParameter.super.getDefaultExpression();
}
}
@@ -11,6 +11,9 @@ public interface PyTypeParameterStub extends NamedStub<PyTypeParameter> {
@Nullable
String getBoundExpressionText();
@Nullable
String getDefaultExpressionText();
@NotNull
PyTypeParameter.Kind getKind();
}