Skip to content

Commit

Permalink
[flow][easy] rename mk_exact_empty to mk_frozen_exact_empty
Browse files Browse the repository at this point in the history
Summary:
This function enables the "frozen" flag that cannot be used lightly, since it makes the assumption that the object it refers to is unaliased. This diff updates its name to make this more clear.

Changelog: [internal]

Reviewed By: SamChou19815

Differential Revision: D57134537

fbshipit-source-id: 49d81e02b853f7aac4b79508abf05aef36eb48be
  • Loading branch information
panagosg7 authored and facebook-github-bot committed May 9, 2024
1 parent 9a027f7 commit ea274c7
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/typing/obj_type.ml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ let mk_with_proto
in
DefT (reason, ObjT (mk_objecttype ?reachable_targs ~flags ~call pmap proto))

let mk_exact_empty cx reason =
let mk_frozen_exact_empty cx reason =
ObjProtoT reason |> mk_with_proto cx reason ~obj_kind:Exact ~frozen:true

let mk ~obj_kind cx reason = mk_with_proto cx ~obj_kind reason (ObjProtoT reason)
Expand Down
2 changes: 1 addition & 1 deletion src/typing/statement.ml
Original file line number Diff line number Diff line change
Expand Up @@ -2208,7 +2208,7 @@ module Make
in
Flow.flow cx (elem_t, check);
(* No properties are added in this case. *)
Obj_type.mk_exact_empty cx reason_obj
Obj_type.mk_frozen_exact_empty cx reason_obj
| Named { name; reason; _ } ->
let prop =
Field
Expand Down
4 changes: 2 additions & 2 deletions src/typing/type_sig_merge.ml
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,7 @@ let merge_exports =
let exports =
match exports with
| Some (lazy t) -> t
| None -> Obj_type.mk_exact_empty file.cx reason
| None -> Obj_type.mk_frozen_exact_empty file.cx reason
in
let type_exports = SMap.map Lazy.force type_exports |> NameUtils.namemap_of_smap in
let type_stars = List.map (merge_star file) type_stars in
Expand Down Expand Up @@ -1879,7 +1879,7 @@ and merge_component
let param =
let rest_t =
match rest_param with
| None -> Obj_type.mk_exact_empty file.cx config_reason
| None -> Obj_type.mk_frozen_exact_empty file.cx config_reason
| Some (Type_sig.ComponentRestParam { t }) -> merge env file t
in
EvalT
Expand Down

0 comments on commit ea274c7

Please sign in to comment.