aboutsummaryrefslogtreecommitdiff
path: root/src/typecheck.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/typecheck.c')
-rw-r--r--src/typecheck.c10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/typecheck.c b/src/typecheck.c
index af726a14..139f0655 100644
--- a/src/typecheck.c
+++ b/src/typecheck.c
@@ -74,7 +74,7 @@ type_t *parse_type_ast(env_t *env, type_ast_t *ast) {
if (has_stack_memory(key_type))
code_err(key_type_ast, "Tables can't have stack references because the list may outlive the stack frame.");
- type_t *val_type = table_type->value ? parse_type_ast(env, table_type->value) : EMPTY_TYPE;
+ type_t *val_type = table_type->value ? parse_type_ast(env, table_type->value) : PRESENT_TYPE;
if (!val_type) code_err(ast, "I can't figure out what the value type for this entry is.");
if (table_type->value && has_stack_memory(val_type))
@@ -809,7 +809,7 @@ type_t *get_type(env_t *env, ast_t *ast) {
DeclareMatch(e, entry_ast, TableEntry);
type_t *key_t = get_type(scope, e->key);
- type_t *value_t = e->value ? get_type(scope, e->value) : EMPTY_TYPE;
+ type_t *value_t = e->value ? get_type(scope, e->value) : PRESENT_TYPE;
type_t *key_merged = key_type ? type_or_type(key_type, key_t) : key_t;
if (!key_merged) ambiguous_key_type = true;
@@ -842,7 +842,7 @@ type_t *get_type(env_t *env, ast_t *ast) {
} else if (comp->expr->tag == TableEntry) {
DeclareMatch(e, comp->expr, TableEntry);
return Type(TableType, .key_type = get_type(scope, e->key),
- .value_type = e->value ? get_type(scope, e->value) : EMPTY_TYPE, .env = env);
+ .value_type = e->value ? get_type(scope, e->value) : PRESENT_TYPE, .env = env);
} else {
return Type(ListType, .item_type = get_type(scope, comp->expr));
}
@@ -964,7 +964,7 @@ type_t *get_type(env_t *env, ast_t *ast) {
else if (streq(call->name, "sorted")) return self_value_t;
else if (streq(call->name, "to")) return self_value_t;
else if (streq(call->name, "unique"))
- return Type(TableType, .key_type = item_type, .value_type = EMPTY_TYPE);
+ return Type(TableType, .key_type = item_type, .value_type = PRESENT_TYPE);
else code_err(ast, "There is no '", call->name, "' method for lists");
}
case TableType: {
@@ -1718,7 +1718,7 @@ PUREFUNC bool can_compile_to_type(env_t *env, ast_t *ast, type_t *needed) {
if (entry->ast->tag != TableEntry) continue; // TODO: fix this
DeclareMatch(e, entry->ast, TableEntry);
if (!can_compile_to_type(env, e->key, key_type)
- || !(e->value ? can_compile_to_type(env, e->value, value_type) : type_eq(value_type, EMPTY_TYPE)))
+ || !(e->value ? can_compile_to_type(env, e->value, value_type) : type_eq(value_type, PRESENT_TYPE)))
return false;
}
return true;