From 9667272414380e2d50113e0a0c6408a02e7c23eb Mon Sep 17 00:00:00 2001 From: lemon Date: Fri, 5 Aug 2022 07:28:56 +0200 Subject: fn type syntax, bugfixs --- bootstrap/types.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'bootstrap/types.c') 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])) -- cgit v1.2.3