commit 1cb802942ea7cc8fee8947e8b551bcf4b5f7deb4
parent eeb39ccb3d73786467b62e514fe3d79f25e934d1
Author: Drew DeVault <sir@cmpwn.com>
Date: Tue, 31 Aug 2021 13:52:26 +0200
type store: early return from reduce on 1 type
This fixes the case where the only input is null, which hits an edge
case later on.
Signed-off-by: Drew DeVault <sir@cmpwn.com>
Diffstat:
1 file changed, 2 insertions(+), 0 deletions(-)
diff --git a/src/type_store.c b/src/type_store.c
@@ -965,6 +965,8 @@ type_store_reduce_result(struct type_store *store, struct type_tagged_union *in)
{
if (!in) {
return &builtin_type_void;
+ } else if (!in->next) {
+ return in->type;
}
const struct type *type = type_store_lookup_tagged(store, in);