PY-61883 PEP 695 Type Parameter Syntax: Make PyTypingTypeProvider aware of the new-style type parameters and aliases

Inherit PyTypeAliasStatement from PyQualifiedNameOwner to re-use type aliases stack in PyTypingTypeProvider

Various tests for the changes above

Co-authored-by: Mikhail Golubev <mikhail.golubev@jetbrains.com>

GitOrigin-RevId: 242427c6f84c05ec48c94085f20675b8e30f8625
This commit is contained in:
Daniil Kalinin
2023-11-06 13:41:13 +01:00
committed by intellij-monorepo-bot
parent 0ca9ba4a99
commit eb58a3805e
18 changed files with 804 additions and 14 deletions

View File

@@ -0,0 +1,4 @@
from typing import Protocol
# classes having type parameter list implicitly inherit from typing.Generic
class Clazz[T](Protocol): ...

View File

@@ -0,0 +1,3 @@
class Stack[T]:
def pop() -> T:
pass

View File

@@ -0,0 +1,2 @@
def foo[T](x: T) -> T:
pass

View File

@@ -0,0 +1 @@
type alias[T, U] = dict[T, U]

View File

@@ -0,0 +1,4 @@
from typing import Callable
def changes_return_type_to_str[**P](x: Callable[P, int]) -> Callable[P, str]:
...

View File

@@ -0,0 +1,3 @@
from typing import List, Union
type MyType = Union[List['MyType'], int]

View File

@@ -0,0 +1,2 @@
type alias2 = 'alias'
type alias = alias2