Skip to content

Commit 4f9dd53

Browse files
committed
mark Term subclasses as final
1 parent 1ba2ad9 commit 4f9dd53

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

lambda_calculus/terms/__init__.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
from abc import abstractmethod
77
from collections.abc import Sequence, Set, Iterable, Iterator
88
from dataclasses import dataclass
9-
from typing import TypeVar
9+
from typing import TypeVar, final
1010
from .. import visitors
1111
from ..errors import CollisionError
1212
from ..visitors import walking
@@ -128,6 +128,7 @@ def is_combinator(self) -> bool:
128128
return not self.free_variables()
129129

130130

131+
@final
131132
@dataclass(unsafe_hash=True, slots=True)
132133
class Variable(Term[V]):
133134
"""
@@ -197,6 +198,7 @@ def accept(self, visitor: visitors.Visitor[T, V]) -> T:
197198
return visitor.visit_variable(self)
198199

199200

201+
@final
200202
@dataclass(unsafe_hash=True, slots=True)
201203
class Abstraction(Term[V]):
202204
"""
@@ -316,6 +318,7 @@ def replace(self, *, bound: V | None = None, body: Term[V] | None = None) -> Abs
316318
)
317319

318320

321+
@final
319322
@dataclass(unsafe_hash=True, slots=True)
320323
class Application(Term[V]):
321324
"""

0 commit comments

Comments
 (0)