From 8690bb71cf6252122e940b35f415aa26e10e6e56 Mon Sep 17 00:00:00 2001 From: sofia Date: Mon, 28 Jul 2025 01:46:17 +0300 Subject: [PATCH] Fix nullptr type --- examples/hello_world_harder.reid | 2 +- reid/src/codegen/intrinsics.rs | 7 +++++-- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/examples/hello_world_harder.reid b/examples/hello_world_harder.reid index bb2802d..0132072 100644 --- a/examples/hello_world_harder.reid +++ b/examples/hello_world_harder.reid @@ -6,7 +6,7 @@ fn main() { test.push(String::from(" world: ")); - test.push_num("hello"); + test.push_num(175); print(test); diff --git a/reid/src/codegen/intrinsics.rs b/reid/src/codegen/intrinsics.rs index 66ce541..c58b0d7 100644 --- a/reid/src/codegen/intrinsics.rs +++ b/reid/src/codegen/intrinsics.rs @@ -1,4 +1,4 @@ -use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr}; +use reid_lib::{builder::InstructionValue, CmpPredicate, ConstValue, Instr, Type}; use crate::{ codegen::{ErrorKind, StackValueKind}, @@ -284,7 +284,10 @@ impl IntrinsicFunction for IntrinsicNullPtr { let zero = scope.block.build(Instr::Constant(ConstValue::I8(0))).unwrap(); let instr = scope .block - .build(Instr::IntToPtr(zero, self.0.get_type(scope.type_values))) + .build(Instr::IntToPtr( + zero, + Type::Ptr(Box::new(self.0.get_type(scope.type_values))), + )) .unwrap(); Ok(StackValue(StackValueKind::Literal(instr), self.0.clone())) }