diff --git a/src/frontend/moduleTypechecker.ml b/src/frontend/moduleTypechecker.ml index cd08d0ccc..c579ec554 100644 --- a/src/frontend/moduleTypechecker.ml +++ b/src/frontend/moduleTypechecker.ml @@ -765,14 +765,12 @@ and typecheck_binding (config : typecheck_config) (tyenv : Typeenv.t) (utbind : in return ([ Rec(recbindacc |> Alist.to_list) ], ssig) - | UTMutable((rng, varnm) as var, utastI) -> - let* (eI, tyI) = Typechecker.typecheck { pre with quantifiability = Unquantifiable; } tyenv utastI in - let evid = EvalVarID.fresh var in - let pty = TypeConv.lift_poly (rng, RefType(tyI)) in + | UTMutable(ident, utastI) -> + let* (varnm, pty_ref, evid, eI) = Typechecker.typecheck_let_mutable pre tyenv ident utastI in let ssig = let ventry = { - val_type = pty; + val_type = pty_ref; val_name = Some(evid); val_stage = pre.stage; } diff --git a/src/frontend/typechecker.mli b/src/frontend/typechecker.mli index 600743785..70d9e0078 100644 --- a/src/frontend/typechecker.mli +++ b/src/frontend/typechecker.mli @@ -9,6 +9,8 @@ val typecheck_letrec : pre -> type_environment -> untyped_let_binding list -> (( val typecheck_nonrec : always_polymorphic:bool -> pre -> type_environment -> untyped_let_binding -> (var_name * poly_type * EvalVarID.t * abstract_tree, type_error) result +val typecheck_let_mutable : pre -> type_environment -> var_name ranged -> untyped_abstract_tree -> (var_name * poly_type * EvalVarID.t * abstract_tree, type_error) result + val main : typecheck_config -> stage -> Typeenv.t -> untyped_abstract_tree -> (mono_type * abstract_tree, type_error) result val are_unifiable : mono_type -> mono_type -> bool