Skip to content

Commit ea2aa81

Browse files
committed
comment + rename file
1 parent e688272 commit ea2aa81

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed
File renamed without changes.

jscomp/ml/typecore.ml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1384,7 +1384,7 @@ and type_pat_aux ~constrs ~labels ~no_existentials ~mode ~explode ~env
13841384
| _ -> k None
13851385
end
13861386
| Ppat_record(lid_sp_list, closed) ->
1387-
let has_dict_pattern_attr = Dicts.has_dict_pattern_attribute sp.ppat_attributes in
1387+
let has_dict_pattern_attr = Dict_type_helpers.has_dict_pattern_attribute sp.ppat_attributes in
13881388
let opath, record_ty = (
13891389
match (has_dict_pattern_attr, expected_ty.desc) with
13901390
| (true, Tvar _) ->
@@ -3029,7 +3029,11 @@ and type_label_access env srecord lid =
30293029
try
30303030
match extract_concrete_typedecl env ty_exp with
30313031
| (p0, _, {type_attributes})
3032-
when Path.same p0 Predef.path_dict && Dicts.has_dict_attribute type_attributes ->
3032+
when Path.same p0 Predef.path_dict && Dict_type_helpers.has_dict_attribute type_attributes ->
3033+
(* Cover the case when trying to direct field access on a dict, e.g. `someDict.name`.
3034+
We need to disallow this because the fact that a dict is represented as a single field
3035+
record internally is just an implementation detail, and not intended to be exposed to
3036+
the user.*)
30333037
raise(Error(lid.loc, env, Field_access_on_dict_type))
30343038
| (p0, p, {type_kind=Type_record _}) -> Some(p0, p)
30353039
| _ -> None

0 commit comments

Comments
 (0)