From cb6a5f264c857691cf3db3c9d8e12375e4dc75fd Mon Sep 17 00:00:00 2001 From: Bruce Hill Date: Sat, 5 Apr 2025 01:43:20 -0400 Subject: Fix up some tests and type_or_type --- src/types.c | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/types.c') diff --git a/src/types.c b/src/types.c index 93326b17..dc330ca9 100644 --- a/src/types.c +++ b/src/types.c @@ -153,6 +153,12 @@ type_t *type_or_type(type_t *a, type_t *b) return a->tag == OptionalType ? a : Type(OptionalType, a); if (a->tag == ReturnType && b->tag == ReturnType) return Type(ReturnType, .ret=type_or_type(Match(a, ReturnType)->ret, Match(b, ReturnType)->ret)); + + if (is_incomplete_type(a) && type_eq(b, most_complete_type(a, b))) + return b; + if (is_incomplete_type(b) && type_eq(a, most_complete_type(a, b))) + return a; + if (type_is_a(b, a)) return a; if (type_is_a(a, b)) return b; if (a->tag == AbortType || a->tag == ReturnType) return non_optional(b); -- cgit v1.2.3