diff --git a/nac3artiq/src/codegen.rs b/nac3artiq/src/codegen.rs index 8c7809b64..4d4b4f194 100644 --- a/nac3artiq/src/codegen.rs +++ b/nac3artiq/src/codegen.rs @@ -461,8 +461,8 @@ fn format_rpc_arg<'ctx>( let llvm_usize = generator.get_size_type(ctx.ctx); let (elem_ty, _) = unpack_ndarray_var_tys(&mut ctx.unifier, arg_ty); - let llvm_arg_ty = - NDArrayType::new(generator, ctx.ctx, ctx.get_llvm_type(generator, elem_ty)); + let llvm_elem_ty = ctx.get_llvm_type(generator, elem_ty); + let llvm_arg_ty = NDArrayType::new(generator, ctx.ctx, llvm_elem_ty); let llvm_arg = NDArrayValue::from_ptr_val(arg.into_pointer_value(), llvm_usize, None); let llvm_usize_sizeof = ctx @@ -472,7 +472,7 @@ fn format_rpc_arg<'ctx>( let llvm_pdata_sizeof = ctx .builder .build_int_truncate_or_bit_cast( - llvm_arg_ty.element_type().ptr_type(AddressSpace::default()).size_of(), + llvm_elem_ty.ptr_type(AddressSpace::default()).size_of(), llvm_usize, "", ) @@ -630,7 +630,7 @@ fn format_rpc_ret<'ctx>( let llvm_pdata_sizeof = ctx .builder .build_int_truncate_or_bit_cast( - llvm_ret_ty.element_type().size_of().unwrap(), + llvm_elem_ty.ptr_type(AddressSpace::default()).size_of(), llvm_usize, "", ) diff --git a/nac3core/src/codegen/classes.rs b/nac3core/src/codegen/classes.rs index 9ebac518e..3d548205f 100644 --- a/nac3core/src/codegen/classes.rs +++ b/nac3core/src/codegen/classes.rs @@ -1250,11 +1250,13 @@ impl<'ctx> NDArrayType<'ctx> { /// Returns the element type of this `ndarray` type. #[must_use] - pub fn element_type(&self) -> BasicTypeEnum<'ctx> { + pub fn element_type(&self) -> AnyTypeEnum<'ctx> { self.as_base_type() .get_element_type() .into_struct_type() .get_field_type_at_index(2) + .map(BasicTypeEnum::into_pointer_type) + .map(PointerType::get_element_type) .unwrap() } }