1818from dataclasses import InitVar , dataclass , replace
1919from inspect import Parameter , Signature
2020from 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
2323from .declarations import *
2424from .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