From 24ac3820b20b243114bba18ddefb2c3d7ccd9540 Mon Sep 17 00:00:00 2001 From: lyken Date: Fri, 5 Jul 2024 10:36:47 +0800 Subject: [PATCH] core: check int32 obj_id directly in fold_numpy_function_call_shape_argument --- nac3core/src/typecheck/type_inferencer/mod.rs | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/nac3core/src/typecheck/type_inferencer/mod.rs b/nac3core/src/typecheck/type_inferencer/mod.rs index c20fe78d..d959c1ab 100644 --- a/nac3core/src/typecheck/type_inferencer/mod.rs +++ b/nac3core/src/typecheck/type_inferencer/mod.rs @@ -980,11 +980,10 @@ impl<'a> Inferencer<'a> { // `ndims` can be deduced statically from the inferred Tuple type. tuple_element_types.len() as u64 } - TypeEnum::TObj { .. } => { - // Handle 3. An integer (generalized as [`TypeEnum::TObj`]) - - // Typecheck - self.unify(self.primitives.int32, shape_ty, &shape.location)?; + TypeEnum::TObj { obj_id, .. } + if *obj_id == self.primitives.int32.obj_id(self.unifier).unwrap() => + { + // Handle 3. An int32 (generalized as [`TypeEnum::TObj`]) // Deduce `ndims` 1