Skip to content

Commit

Permalink
Fix readonly check for like arrays
Browse files Browse the repository at this point in the history
Summary: Readonly is implemented as a Tast_check that does a match over types, so it looks at locl tys which can be like types due to lack of enforcement. Look through likeness when checking if it is a Hack array.

Differential Revision: D45928361

fbshipit-source-id: dfc0309413cc76ac166642d9fd03210a41206fe6
  • Loading branch information
vassilmladenov authored and facebook-github-bot committed May 17, 2023
1 parent 8f468f9 commit 045810c
Showing 1 changed file with 1 addition and 0 deletions.
1 change: 1 addition & 0 deletions hphp/hack/src/typing/tast_check/readonly_check.ml
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ let rec ty_expr env ((_, _, expr_) : Tast.expr) : rty =
let is_value_collection_ty env ty =
let mixed = MakeType.mixed Reason.none in
let env = Tast_env.tast_env_as_typing_env env in
let ty = Typing_utils.strip_dynamic env ty in
let hackarray = MakeType.any_array Reason.none mixed mixed in
(* Subtype against an empty open shape (shape(...)) *)
let shape = MakeType.open_shape Reason.none Typing_defs.TShapeMap.empty in
Expand Down

0 comments on commit 045810c

Please sign in to comment.