Skip to content

Commit 867db09

Browse files
Add assert never
1 parent a6a7961 commit 867db09

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

python/egglog/runtime.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
from dataclasses import InitVar, dataclass, replace
1919
from inspect import Parameter, Signature
2020
from itertools import zip_longest
21-
from typing import TYPE_CHECKING, Any, TypeVar, Union, cast, get_args, get_origin
21+
from typing import TYPE_CHECKING, Any, TypeVar, Union, assert_never, cast, get_args, get_origin
2222

2323
from .declarations import *
2424
from .pretty import *
@@ -690,7 +690,7 @@ def resolve_callable(callable: object) -> tuple[CallableRef, Declarations]:
690690
raise NotImplementedError(f"Cannot turn {callable} of type {type(callable)} into a callable ref")
691691

692692

693-
def create_callable(decls: Declarations, ref: CallableRef) -> RuntimeFunction | RuntimeExpr:
693+
def create_callable(decls: Declarations, ref: CallableRef) -> RuntimeClass | RuntimeFunction | RuntimeExpr:
694694
"""
695695
Creates a callable object from a callable ref. This might not actually be callable, if the ref is a constant
696696
or classvar then it is a value
@@ -705,4 +705,6 @@ def create_callable(decls: Declarations, ref: CallableRef) -> RuntimeFunction |
705705
tp = decls._constants[name].type_ref
706706
case ClassVariableRef(cls_name, var_name):
707707
tp = decls._classes[cls_name].class_variables[var_name].type_ref
708+
case _:
709+
assert_never(ref)
708710
return RuntimeExpr.__from_values__(decls, TypedExprDecl(tp, CallDecl(ref)))

0 commit comments

Comments
 (0)