Describe the bug
Creating a type variable that uses another type variable in its bound type creates an error even if the bound type is not generic within the scope of the type variable.
Sidenote: Not sure if this is another bug but I have set typeCheckingMode to "off" and I am still seeing this error.
To Reproduce
from abc import ABC
from typing import Generic, TypeVar
R = TypeVar("R", bound="AbstractRepository")
class AbstractRepository(ABC):
pass
class AbstractUnitOfWork(ABC, Generic[R]):
repo: R
T = TypeVar("T", bound="AbstractUnitOfWork[R]")
def commit(self: T) -> T:
return self
I get an error saying "TypeVar bound type cannot be generic" when defining T even though AbstractUnitOfWork[R] is not a generic type in this context.
Expected behavior
No error.
VS Code extension or command-line
I am running Pyright within Neovim. The version is 1.1.248
Describe the bug
Creating a type variable that uses another type variable in its bound type creates an error even if the bound type is not generic within the scope of the type variable.
Sidenote: Not sure if this is another bug but I have set
typeCheckingModeto"off"and I am still seeing this error.To Reproduce
I get an error saying "TypeVar bound type cannot be generic" when defining
Teven thoughAbstractUnitOfWork[R]is not a generic type in this context.Expected behavior
No error.
VS Code extension or command-line
I am running Pyright within Neovim. The version is
1.1.248