From 58e6b049a20ea9dbe4b8523374ce02a728d30286 Mon Sep 17 00:00:00 2001 From: "Jonathan D.A. Jewell" <6759885+hyperpolymath@users.noreply.github.com> Date: Sun, 17 May 2026 15:43:59 +0100 Subject: [PATCH] fix(typecheck): infer Ref kind as arity-1 ctor (#135 slice 10) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit effects.affine externs (make_ref/get/set) use Ref, an undeclared opaque type constructor from the `state` effect. infer_kind hardcodes known opaque ctors (Array/Option/List/Vec/Cmd arity-1, Result arity-2) and falls back to KType for the rest, so TApp(Ref,[T]) hit check_kind_app's 'Too many arguments for kind'. Ref is the direct analogue of Cmd (Stage-11 opaque effect ctor) — add it to the arity-1 list. effects.affine now compiles resolve->typecheck; 12/19 stdlib green, zero regression. Refs #128 --- lib/typecheck.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/typecheck.ml b/lib/typecheck.ml index 75bda100..007cc2d1 100644 --- a/lib/typecheck.ml +++ b/lib/typecheck.ml @@ -311,7 +311,7 @@ let rec infer_kind (ctx : context) (ty : ty) : kind result = end | TCon name -> begin match name with - | "Array" | "Option" | "List" | "Vec" | "Cmd" -> Ok (KArrow (KType, KType)) + | "Array" | "Option" | "List" | "Vec" | "Cmd" | "Ref" -> Ok (KArrow (KType, KType)) | "Result" -> Ok (KArrow (KType, KArrow (KType, KType))) | _ -> Ok KType end