diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-05 01:43:20 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-05 01:43:20 -0400 |
| commit | cb6a5f264c857691cf3db3c9d8e12375e4dc75fd (patch) | |
| tree | 38f938b4bd9462f21384604c3473841454fe4eef /src/types.c | |
| parent | 00fd2b9e6705cf80e315c84b35feb6248305770b (diff) | |
Fix up some tests and type_or_type
Diffstat (limited to 'src/types.c')
| -rw-r--r-- | src/types.c | 6 |
1 files changed, 6 insertions, 0 deletions
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); |
