aboutsummaryrefslogtreecommitdiff
path: root/bootstrap/types.c
diff options
context:
space:
mode:
authorlemon <lsof@mailbox.org>2022-08-05 07:28:56 +0200
committerlemon <lsof@mailbox.org>2022-08-05 07:28:56 +0200
commit9667272414380e2d50113e0a0c6408a02e7c23eb (patch)
tree9537c57f7b13aa43ce63553ca44d8ba42e6ed1c3 /bootstrap/types.c
parentfc29f3f2b0c3a7c5ef1c75d910cf0815d2edbba2 (diff)
fn type syntax, bugfixs
Diffstat (limited to 'bootstrap/types.c')
-rw-r--r--bootstrap/types.c5
1 files changed, 4 insertions, 1 deletions
diff --git a/bootstrap/types.c b/bootstrap/types.c
index 7491b4b..386ad58 100644
--- a/bootstrap/types.c
+++ b/bootstrap/types.c
@@ -52,6 +52,7 @@ hashtype(const struct type *ty) {
h = jkhashv(h, ty->fn.params.n);
for (int i = 0; i < ty->fn.params.n; ++i)
h = jkhashv(h, ty->fn.params.d[i]->_id);
+ break;
case TYenum:
h = jkhashv(h, ty->enu.id);
break;
@@ -81,7 +82,9 @@ typeeql(const struct type *lhs, const struct type *rhs) {
case TYarr:
return lhs->length == rhs->length && typeeql(lhs->child, rhs->child);
case TYfn:
- if (lhs->length != rhs->length)
+ if (lhs->fn.params.n != rhs->fn.params.n)
+ return 0;
+ if (lhs->fn.variadic != rhs->fn.variadic)
return 0;
for (int i = 0; i < lhs->fn.params.n; ++i)
if (!typeeql(lhs->fn.params.d[i], rhs->fn.params.d[i]))