diff options
| author | Bruce Hill <bruce@bruce-hill.com> | 2025-04-04 18:29:09 -0400 |
|---|---|---|
| committer | Bruce Hill <bruce@bruce-hill.com> | 2025-04-04 18:29:09 -0400 |
| commit | 7b735ab6fc3e0bb368f1ca484168eaefbbe3ce9c (patch) | |
| tree | 4a7c78bb0967b8fbc1042d901cf0346705d9d0d8 /src/types.c | |
| parent | 0b8074154e2671691050bdb3bcb33245625a056c (diff) | |
Misc fixes
Diffstat (limited to 'src/types.c')
| -rw-r--r-- | src/types.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/types.c b/src/types.c index 0b9bc72b..93326b17 100644 --- a/src/types.c +++ b/src/types.c @@ -111,6 +111,8 @@ PUREFUNC const char *get_type_name(type_t *t) bool type_eq(type_t *a, type_t *b) { if (a == b) return true; + if (!a && !b) return true; + if (!a || !b) return false; if (a->tag != b->tag) return false; return (CORD_cmp(type_to_cord(a), type_to_cord(b)) == 0); } @@ -208,10 +210,8 @@ static PUREFUNC INLINE double type_max_magnitude(type_t *t) PUREFUNC precision_cmp_e compare_precision(type_t *a, type_t *b) { - if (a->tag == OptionalType && Match(a, OptionalType)->type->tag == NumType) - a = Match(a, OptionalType)->type; - if (b->tag == OptionalType && Match(b, OptionalType)->type->tag == NumType) - b = Match(b, OptionalType)->type; + if (a == NULL || b == NULL) + return NUM_PRECISION_INCOMPARABLE; if (is_int_type(a) && b->tag == NumType) return NUM_PRECISION_LESS; |
