Skip to content

Commit

Permalink
Fixed formatting of test case. No functional change.
Browse files Browse the repository at this point in the history
  • Loading branch information
msfterictraut committed Jul 21, 2023
1 parent 6e3404a commit 37f8149
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions packages/pyright-internal/src/tests/samples/typeVar12.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,47 +5,55 @@

from typing import Callable, Generic, Optional, ParamSpec, TypeVar

S = TypeVar('S')
T = TypeVar('T')
P = ParamSpec('P')
S = TypeVar("S")
T = TypeVar("T")
P = ParamSpec("P")

CallableAlias1 = Callable[[T], T]
CallableAlias2 = Callable[[T], T] | T


def func1() -> Callable[[T], T] | None:
# This should generate an error.
x: Optional[T] = None


def func2() -> Callable[[T], T] | list[T] | None:
x: Optional[T] = None


def func3() -> CallableAlias1[T] | None:
# This should generate an error.
x: Optional[T] = None


def func4() -> CallableAlias2[T] | None:
x: Optional[T] = None


def func5() -> Callable[[list[T]], set[T]] | None:
# This should generate an error.
x: Optional[T] = None


def func6() -> Callable[[list[T]], set[T]] | Callable[[set[T]], set[T]] | None:
x: Optional[T] = None


def func7() -> Callable[P, None] | None:
# This should generate two errors, once for each P reference.
def inner(*args: P.args, **kwargs: P.kwargs) -> None:
pass

return


class A(Generic[T]):
def method1(self) -> Callable[[T], T] | None:
x: Optional[T] = None


class B(Generic[S]):
def method1(self) -> Callable[[T], T] | None:
# This should generate an error.
x: Optional[T] = None

0 comments on commit 37f8149

Please sign in to comment.