core: check int32 obj_id directly in fold_numpy_function_call_shape_argument

This commit is contained in:
lyken 2024-07-05 10:36:47 +08:00
parent ba32fab374
commit 24ac3820b2

View File

@ -980,11 +980,10 @@ impl<'a> Inferencer<'a> {
// `ndims` can be deduced statically from the inferred Tuple type. // `ndims` can be deduced statically from the inferred Tuple type.
tuple_element_types.len() as u64 tuple_element_types.len() as u64
} }
TypeEnum::TObj { .. } => { TypeEnum::TObj { obj_id, .. }
// Handle 3. An integer (generalized as [`TypeEnum::TObj`]) if *obj_id == self.primitives.int32.obj_id(self.unifier).unwrap() =>
{
// Typecheck // Handle 3. An int32 (generalized as [`TypeEnum::TObj`])
self.unify(self.primitives.int32, shape_ty, &shape.location)?;
// Deduce `ndims` // Deduce `ndims`
1 1