aboutsummaryrefslogtreecommitdiff
path: root/typecheck.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-10-08 21:10:36 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-10-08 21:10:36 -0400
commit839c1983a0dad0232da3ceda9c7c02a49715453c (patch)
tree955e588981f589b780257c2a8a6fade286f41876 /typecheck.c
parent5103fde1c5e7e92f00801fb3a0e3662e436ee881 (diff)
Reduce padding needed for optional types and clean up some redundant
type padding
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c12
1 files changed, 6 insertions, 6 deletions
diff --git a/typecheck.c b/typecheck.c
index c50e01be..d056d6e4 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -54,9 +54,9 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast)
if (!item_t) code_err(item_type, "I can't figure out what this type is.");
if (has_stack_memory(item_t))
code_err(item_type, "Arrays can't have stack references because the array may outlive the stack frame.");
- if (padded_type_size(item_t) > ARRAY_MAX_STRIDE)
+ if (type_size(item_t) > ARRAY_MAX_STRIDE)
code_err(ast, "This array holds items that take up %ld bytes, but the maximum supported size is %ld bytes. Consider using an array of pointers instead.",
- padded_type_size(item_t), ARRAY_MAX_STRIDE);
+ type_size(item_t), ARRAY_MAX_STRIDE);
return Type(ArrayType, .item_type=item_t);
}
case SetTypeAST: {
@@ -65,9 +65,9 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast)
if (!item_t) code_err(item_type, "I can't figure out what this type is.");
if (has_stack_memory(item_t))
code_err(item_type, "Sets can't have stack references because the array may outlive the stack frame.");
- if (padded_type_size(item_t) > ARRAY_MAX_STRIDE)
+ if (type_size(item_t) > ARRAY_MAX_STRIDE)
code_err(ast, "This set holds items that take up %ld bytes, but the maximum supported size is %ld bytes. Consider using an set of pointers instead.",
- padded_type_size(item_t), ARRAY_MAX_STRIDE);
+ type_size(item_t), ARRAY_MAX_STRIDE);
return Type(SetType, .item_type=item_t);
}
case ChannelTypeAST: {
@@ -76,9 +76,9 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast)
if (!item_t) code_err(item_type, "I can't figure out what this type is.");
if (!can_send_over_channel(item_t))
code_err(ast, "This item type can't be sent over a channel because it contains reference to memory that may not be thread-safe.");
- if (padded_type_size(item_t) > ARRAY_MAX_STRIDE)
+ if (type_size(item_t) > ARRAY_MAX_STRIDE)
code_err(ast, "This channel holds items that take up %ld bytes, but the maximum supported size is %ld bytes.",
- padded_type_size(item_t), ARRAY_MAX_STRIDE);
+ type_size(item_t), ARRAY_MAX_STRIDE);
return Type(ChannelType, .item_type=item_t);
}
case TableTypeAST: {