add expected type check

This commit is contained in:
2025-11-27 12:44:12 +05:30
parent 189526d5ca
commit 9becee8f77

View File

@ -181,7 +181,7 @@ def handle_variable_assignment(
expected_ptr_type = ir.PointerType(struct_info.ir_type)
# Check if var_type matches the expected pointer type
if isinstance(var_type, ir.PointerType):
if isinstance(var_type, ir.PointerType) and var_type == expected_ptr_type:
# val is already the correct pointer type from inttoptr/bitcast
builder.store(val, var_ptr)
logger.info(f"Assigned user-defined struct pointer cast to {var_name}")