1- from typing import Iterable , cast
1+ from typing import Iterable
22
33from kirin import ir , types
44from kirin .interp import Frame , MethodTable , ReturnValue , impl
@@ -38,7 +38,7 @@ def return_(
3838 def call (self , interp : TypeInference , frame : Frame , stmt : Call ):
3939 # give up on dynamic method calls
4040 mt = interp .maybe_const (stmt .callee , ir .Method )
41- if mt is None :
41+ if mt is None : # not a constant method
4242 return self ._solve_method_type (interp , frame , stmt )
4343 return self ._invoke_method (
4444 interp ,
@@ -57,16 +57,14 @@ def _solve_method_type(self, interp: TypeInference, frame: Frame, stmt: Call):
5757
5858 if len (mt_inferred .vars ) != 2 :
5959 return (types .Bottom ,)
60-
6160 args = mt_inferred .vars [0 ]
6261 result = mt_inferred .vars [1 ]
6362 if not args .is_subseteq (types .Tuple ):
6463 return (types .Bottom ,)
6564
6665 resolve = TypeResolution ()
67- args = cast (types .Generic , args )
68- for arg , value in zip (args .vars , frame .get_values (stmt .inputs )):
69- resolve .solve (arg , value )
66+ # NOTE: we are not using [...] below to be compatible with 3.10
67+ resolve .solve (args , types .Tuple .where (frame .get_values (stmt .inputs )))
7068 return (resolve .substitute (result ),)
7169
7270 @impl (Invoke )
0 commit comments