aboutsummaryrefslogtreecommitdiff
path: root/typecheck.c
diff options
context:
space:
mode:
authorBruce Hill <bruce@bruce-hill.com>2024-12-01 13:42:08 -0500
committerBruce Hill <bruce@bruce-hill.com>2024-12-01 13:42:08 -0500
commit5e0f76d17f82276781c765738fd49762a2e0af16 (patch)
tree098221f3de654e8ffa79c77d53a39ba4a4ac43b0 /typecheck.c
parent5b661403e1f77b39c6f38573ef8ea8b87c7522c0 (diff)
Fix edge case with nested optional
Diffstat (limited to 'typecheck.c')
-rw-r--r--typecheck.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/typecheck.c b/typecheck.c
index 9284da57..0213dedb 100644
--- a/typecheck.c
+++ b/typecheck.c
@@ -513,6 +513,8 @@ type_t *get_type(env_t *env, ast_t *ast)
if (!Match(ast, None)->type)
return Type(OptionalType, .type=NULL);
type_t *t = parse_type_ast(env, Match(ast, None)->type);
+ if (t->tag == OptionalType)
+ code_err(ast, "Nested optional types are not supported. This should be: `NONE:%T`", Match(t, OptionalType)->type);
return Type(OptionalType, .type=t);
}
case Bool: {