Skip to content

Commit

Permalink
fix Type.refresh_variables to keep the flags
Browse files Browse the repository at this point in the history
  • Loading branch information
FardaleM committed Oct 7, 2024
1 parent e0051f1 commit 521a441
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion lib/common/Type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -316,7 +316,7 @@ let rec refresh_variables bdgs env (t : t) =
| Var v ->
let v' =
Variable.HMap.get_or_add bdgs
~f:(fun _ -> Variable.(Gen.gen Flags.empty env.Env.var_gen)) ~k:v
~f:(fun _ -> Variable.(Gen.gen (get_flags v) env.Env.var_gen)) ~k:v
in
var env v'
| Constr (lid, t) -> constr env lid (Array.map (refresh_variables bdgs env) t)
Expand Down
2 changes: 2 additions & 0 deletions lib/common/Variable.ml
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ let is_pure v = Flags.(equal empty v.flags)
let is_non_arrow v = Flags.(get non_arrow v.flags)
let is_non_tuple v = Flags.(get non_tuple v.flags)

let get_flags {flags; _} = flags

let are_flags_included v1 v2 = Flags.subset v1.flags v2.flags

let merge_flags v1 v2 gen =
Expand Down
2 changes: 2 additions & 0 deletions lib/common/Variable.mli
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ val is_pure : t -> bool
val is_non_arrow : t -> bool
val is_non_tuple : t -> bool

val get_flags : t -> Flags.t

(** [is_flags_includes v1 v2] check if the flags of [v1] are included in the flags of [v2] *)
val are_flags_included : t -> t -> bool

Expand Down

0 comments on commit 521a441

Please sign in to comment.