-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixed a bug that results in a hang under certain circumstances when u…
…sing a recursive type alias. This addresses #9497.
- Loading branch information
Showing
3 changed files
with
40 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
packages/pyright-internal/src/tests/samples/recursiveTypeAlias16.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# This sample tests a case that previously resulted in infinite recursion. | ||
|
||
from typing import TypeVar, Generic | ||
|
||
U = TypeVar("U") | ||
T = TypeVar("T") | ||
|
||
|
||
class A(Generic[T]): | ||
pass | ||
|
||
|
||
class B(Generic[T]): | ||
pass | ||
|
||
|
||
class C(Generic[T]): | ||
pass | ||
|
||
|
||
TA1 = A["TA2[U]"] | B["TA2[U]"] | ||
TA2 = TA1[U] | C[TA1[U]] | ||
TA3 = TA2[U] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters