@@ -765,13 +765,6 @@ def Union(self, parameters):
765765
766766 assert Union[Union[int, str], float] == Union[int, str, float]
767767
768- However, this does not apply to unions referenced through a type
769- alias, to avoid forcing evaluation of the underlying
770- TypeAliasType::
771-
772- type A = Union[int, str]
773- assert Union[A, float] != Union[int, str, float]
774-
775768 - Unions of a single argument vanish, e.g.::
776769
777770 assert Union[int] == int # The constructor actually returns int
@@ -837,33 +830,6 @@ def open_helper(file: str, mode: MODE) -> str:
837830 Literal[...] cannot be subclassed. At runtime, an arbitrary value
838831 is allowed as type argument to Literal[...], but type checkers may
839832 impose restrictions.
840-
841- Literal is very similar to Union, the main difference is that its
842- arguments are literal values instead of types:
843-
844- - The arguments must be literal values and there must be at least one.
845-
846- - Nested Literal types are flattened, e.g.::
847-
848- assert Literal[Literal[1, 2], 3] == Literal[1, 2, 3]
849-
850- However, this does not apply to Literal types referenced through a type
851- alias, to avoid forcing evaluation of the underlying TypeAliasType::
852-
853- type A = Literal[1, 2]
854- assert Literal[A, 3] != Literal[1, 2, 3]
855-
856- - Redundant arguments are skipped, e.g.::
857-
858- assert Union[1, 2, 1] == Union[1, 2]
859-
860- - When comparing literals, the argument order is ignored, e.g.::
861-
862- assert Literal[1, 2] == Literal[2, 1]
863-
864- - You cannot subclass or instantiate a Literal.
865-
866- - You cannot write Literal[X][Y].
867833 """
868834 # There is no '_type_check' call because arguments to Literal[...] are
869835 # values, not types.
@@ -2273,13 +2239,6 @@ def Annotated(self, *params):
22732239
22742240 assert Annotated[Annotated[T, Ann1, Ann2], Ann3] == Annotated[T, Ann1, Ann2, Ann3]
22752241
2276- However, this does not apply to Annotated types referenced through
2277- a type alias, to avoid forcing evaluation of the underlying
2278- TypeAliasType::
2279-
2280- type A[T] = Annotated[T, Ann1, Ann2]
2281- assert Annotated[A[T], Ann3] != Annotated[T, Ann1, Ann2, Ann3]
2282-
22832242 - Instantiating an annotated type is equivalent to instantiating the
22842243 underlying type::
22852244
0 commit comments