aboutsummaryrefslogtreecommitdiff
path: root/src/typecheck.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2025-08-31 23:33:22 -0400
committerBruce Hill <bruce@bruce-hill.com>2025-08-31 23:33:22 -0400
commit5fc7577b5a3bc2c445522dfd5b287e1c6eddc3e9 (patch)
tree34d44c9330dc3ec71fc850b95b3412a1ce292cb8 /src/typecheck.c
parenta571ccffd795a595e990a3405dcf977aafc33c6c (diff)
Switch to using optional return values for list indexing.
Diffstat (limited to 'src/typecheck.c')
-rw-r--r--src/typecheck.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/typecheck.c b/src/typecheck.c
index 50df9327..eba12a6e 100644
--- a/src/typecheck.c
+++ b/src/typecheck.c
@@ -890,7 +890,7 @@ type_t *get_type(env_t *env, ast_t *ast) {
if (!indexing->index) return indexed_t;
type_t *index_t = get_type(env, indexing->index);
if (index_t->tag == IntType || index_t->tag == BigIntType || index_t->tag == ByteType)
- return Match(value_t, ListType)->item_type;
+ return Type(OptionalType, Match(value_t, ListType)->item_type);
code_err(indexing->index, "I only know how to index lists using integers, not ", type_to_str(index_t));
} else if (value_t->tag == TableType) {
DeclareMatch(table_type, value_t, TableType);