@@ -290,7 +290,7 @@ let make_constructor env type_path type_params sargs sret_type =
290
290
*)
291
291
292
292
293
- let transl_declaration ~foundObject env sdecl id =
293
+ let transl_declaration ~typeRecordAsObject env sdecl id =
294
294
(* Bind type parameters *)
295
295
reset_type_variables() ;
296
296
Ctype. begin_def () ;
@@ -481,8 +481,8 @@ let transl_declaration ~foundObject env sdecl id =
481
481
check_duplicates lbls StringSet. empty;
482
482
Ttype_record lbls, Type_record (lbls', rep), sdecl
483
483
| None ->
484
- (* Could not fine type decl for ...t: assume t is an object type and this is syntax ambiguity *)
485
- foundObject := true ;
484
+ (* Could not find record type decl for ...t: assume t is an object type and this is syntax ambiguity *)
485
+ typeRecordAsObject := true ;
486
486
let fields = Ext_list. map lbls_ (fun ld ->
487
487
match ld.pld_name.txt with
488
488
| "..." -> Parsetree. Oinherit ld.pld_type
@@ -602,7 +602,7 @@ let check_constraints_labels env visited l pl =
602
602
check_constraints_rec env (get_loc (Ident. name name) pl) visited ty)
603
603
l
604
604
605
- let check_constraints ~foundObject env sdecl (_ , decl ) =
605
+ let check_constraints ~typeRecordAsObject env sdecl (_ , decl ) =
606
606
let visited = ref TypeSet. empty in
607
607
begin match decl.type_kind with
608
608
| Type_abstract -> ()
@@ -651,7 +651,7 @@ let check_constraints ~foundObject env sdecl (_, decl) =
651
651
begin match decl.type_manifest with
652
652
| None -> ()
653
653
| Some ty ->
654
- if not ! foundObject then
654
+ if not ! typeRecordAsObject then
655
655
let sty =
656
656
match sdecl.ptype_manifest with Some sty -> sty | _ -> assert false
657
657
in
@@ -1311,15 +1311,15 @@ let transl_type_decl env rec_flag sdecl_list =
1311
1311
| Asttypes. Recursive | Asttypes. Nonrecursive ->
1312
1312
id, None
1313
1313
in
1314
- let foundObject = ref false in
1314
+ let typeRecordAsObject = ref false in
1315
1315
let transl_declaration name_sdecl (id , slot ) =
1316
1316
current_slot := slot;
1317
1317
Builtin_attributes. warning_scope
1318
1318
name_sdecl.ptype_attributes
1319
- (fun () -> transl_declaration temp_env name_sdecl id)
1319
+ (fun () -> transl_declaration ~type RecordAsObject temp_env name_sdecl id)
1320
1320
in
1321
1321
let tdecls =
1322
- List. map2 ( transl_declaration ~found Object) sdecl_list (List. map id_slots id_list) in
1322
+ List. map2 transl_declaration sdecl_list (List. map id_slots id_list) in
1323
1323
let decls =
1324
1324
List. map (fun tdecl -> (tdecl.typ_id, tdecl.typ_type)) tdecls in
1325
1325
current_slot := None ;
@@ -1367,7 +1367,7 @@ let transl_type_decl env rec_flag sdecl_list =
1367
1367
| None -> () )
1368
1368
sdecl_list tdecls;
1369
1369
(* Check that constraints are enforced *)
1370
- List. iter2 (check_constraints ~found Object newenv) sdecl_list decls;
1370
+ List. iter2 (check_constraints ~type RecordAsObject newenv) sdecl_list decls;
1371
1371
(* Name recursion *)
1372
1372
let decls =
1373
1373
List. map2 (fun sdecl (id , decl ) -> id, name_recursion sdecl id decl)
0 commit comments