@@ -549,11 +549,11 @@ def seq(self) -> "Optional[ISeq[T]]": # type: ignore[override]
549549 raise NotImplementedError ()
550550
551551
552- T_tcoll_co = TypeVar ("T_tcoll_co " , bound = "ITransientCollection" , covariant = True )
552+ T_tcoll = TypeVar ("T_tcoll " , bound = "ITransientCollection" )
553553
554554
555555# Including ABC as a base seems to cause catastrophic meltdown.
556- class IEvolveableCollection (Generic [T_tcoll_co ]):
556+ class IEvolveableCollection (Generic [T_tcoll ]):
557557 """``IEvolveableCollection`` types support creating transient variants of persistent
558558 data structures which can be modified efficiently and then returned back into
559559 persistent data structures once modification is complete.
@@ -563,7 +563,7 @@ class IEvolveableCollection(Generic[T_tcoll_co]):
563563 :lpy:fn:`transient`"""
564564
565565 @abstractmethod
566- def to_transient (self ) -> T_tcoll_co :
566+ def to_transient (self ) -> T_tcoll :
567567 raise NotImplementedError ()
568568
569569
@@ -578,11 +578,11 @@ class ITransientCollection(Generic[T]):
578578 __slots__ = ()
579579
580580 @abstractmethod
581- def cons_transient (self : T_tcoll_co , * elems : T ) -> "T_tcoll_co " :
581+ def cons_transient (self : T_tcoll , * elems : T ) -> "T_tcoll " :
582582 raise NotImplementedError ()
583583
584584 @abstractmethod
585- def to_persistent (self : T_tcoll_co ) -> "IPersistentCollection[T]" :
585+ def to_persistent (self : T_tcoll ) -> "IPersistentCollection[T]" :
586586 raise NotImplementedError ()
587587
588588
@@ -720,6 +720,9 @@ def seq_equals(s1: Union["ISeq", ISequential], s2: Any) -> bool:
720720 return True
721721
722722
723+ T_inner = TypeVar ("T_inner" )
724+
725+
723726class ISeq (ILispObject , IPersistentCollection [T ]):
724727 """``ISeq`` types represent a potentially infinite sequence of elements.
725728
@@ -733,7 +736,7 @@ class ISeq(ILispObject, IPersistentCollection[T]):
733736
734737 __slots__ = ()
735738
736- class _SeqIter (Iterator [T ]):
739+ class _SeqIter (Iterator [T_inner ]):
737740 """Stateful iterator for sequence types.
738741
739742 This is primarily useful for avoiding blowing the stack on a long (or infinite)
@@ -742,7 +745,7 @@ class _SeqIter(Iterator[T]):
742745
743746 __slots__ = ("_cur" ,)
744747
745- def __init__ (self , seq : "ISeq[T ]" ):
748+ def __init__ (self , seq : "ISeq[T_inner ]" ):
746749 self ._cur = seq
747750
748751 def __next__ (self ):
0 commit comments