aboutsummaryrefslogtreecommitdiff
path: root/typecheck.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-08-04 13:03:55 -0400
committerBruce Hill <bruce@bruce-hill.com>2024-08-04 13:03:55 -0400
commitadccc5688062271ca6999a15d6c09bd106462704 (patch)
treee98b706908dbc211539b17773a2e16a73c5da041 /typecheck.c
parent09204f4ce85f49f0b1108223dc271b4405a3c663 (diff)
Switch around some of the logic for array:random() and array:shuffle()
to use Int$random() and return values
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c3
1 files changed, 1 insertions, 2 deletions
diff --git a/typecheck.c b/typecheck.c
index e03deb89..9e94ea2f 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -667,8 +667,7 @@ type_t *get_type(env_t *env, ast_t *ast)
else if (streq(call->name, "sort")) return Type(VoidType);
else if (streq(call->name, "sorted")) return self_value_t;
else if (streq(call->name, "shuffle")) return Type(VoidType);
- else if (streq(call->name, "random"))
- return Type(PointerType, .pointed=Match(self_value_t, ArrayType)->item_type, .is_optional=true, .is_readonly=true);
+ else if (streq(call->name, "random")) return Match(self_value_t, ArrayType)->item_type;
else if (streq(call->name, "sample")) return self_value_t;
else if (streq(call->name, "clear")) return Type(VoidType);
else if (streq(call->name, "from")) return self_value_t;