Skip to content

Commit e1fc78b

Browse files
committed
Fix types
1 parent ed7fca2 commit e1fc78b

File tree

4 files changed

+13
-10
lines changed

4 files changed

+13
-10
lines changed

src/basilisp/lang/compiler/exception.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ def format_compiler_exception( # pylint: disable=too-many-branches,unused-argum
122122
code."""
123123
context_exc: Optional[BaseException] = e.__cause__
124124

125-
lines = [os.linesep]
125+
lines: list[str] = [os.linesep]
126126
if context_exc is not None:
127127
lines.append(f" exception: {type(context_exc)} from {type(e)}{os.linesep}")
128128
else:

src/basilisp/lang/compiler/generator.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1598,7 +1598,7 @@ def _wrapped_do(
15981598
) -> GeneratedPyAST[T_pynode]:
15991599
if isinstance(node, Do) and node.use_var_indirection:
16001600
with ctx.with_var_indirection_override():
1601-
return f(ctx, cast(T_node, node), *args, **kwargs)
1601+
return f(ctx, node, *args, **kwargs)
16021602
else:
16031603
with ctx.with_var_indirection_override(False):
16041604
return f(ctx, node, *args, **kwargs)

src/basilisp/lang/interfaces.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
723726
class 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):

src/basilisp/lang/reader.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ def format_syntax_error( # pylint: disable=unused-argument
162162

163163
context_exc: Optional[BaseException] = e.__cause__
164164

165-
lines = [os.linesep]
165+
lines: list[str] = [os.linesep]
166166
if context_exc is not None:
167167
lines.append(f" exception: {type(context_exc)} from {type(e)}{os.linesep}")
168168
else:

0 commit comments

Comments
 (0)