Skip to content

Commit

Permalink
Make CustomCallChecker.check abstract again
Browse files Browse the repository at this point in the history
  • Loading branch information
mark-koch committed Nov 24, 2023
1 parent 0851fd6 commit 0b4ee03
Showing 1 changed file with 1 addition and 4 deletions.
5 changes: 1 addition & 4 deletions guppy/custom.py
Original file line number Diff line number Diff line change
Expand Up @@ -162,15 +162,12 @@ def _setup(self, ctx: Context, node: AstNode, func: CustomFunction) -> None:
self.node = node
self.func = func

@abstractmethod
def check(self, args: list[ast.expr], ty: GuppyType) -> ast.expr:
"""Checks the return value against a given type.
Returns a (possibly) transformed and annotated AST node for the call.
"""
args, actual = self.synthesize(args)
raise GuppyTypeError(
f"Expected expression of type `{ty}`, got `{actual}`", self.node
)

@abstractmethod
def synthesize(self, args: list[ast.expr]) -> tuple[ast.expr, GuppyType]:
Expand Down

0 comments on commit 0b4ee03

Please sign in to comment.