@@ -1322,7 +1322,7 @@ let get_new_abstract_name env s =
1322
1322
let index = Misc. find_first_mono check in
1323
1323
name index
1324
1324
1325
- let new_local_type ?(loc = Location. none) ?manifest_and_scope jkind =
1325
+ let new_local_type ?(loc = Location. none) ?manifest_and_scope jkind ~ jkind_annot =
1326
1326
let manifest, expansion_scope =
1327
1327
match manifest_and_scope with
1328
1328
None -> None , Btype. lowest_level
@@ -1333,7 +1333,7 @@ let new_local_type ?(loc = Location.none) ?manifest_and_scope jkind =
1333
1333
type_arity = 0 ;
1334
1334
type_kind = Type_abstract Abstract_def ;
1335
1335
type_jkind = jkind;
1336
- type_jkind_annotation = None ;
1336
+ type_jkind_annotation = jkind_annot ;
1337
1337
type_private = Public ;
1338
1338
type_manifest = manifest;
1339
1339
type_variance = [] ;
@@ -1371,7 +1371,7 @@ let instance_constructor existential_treatment cstr =
1371
1371
(* Existential row variable *)
1372
1372
| _ -> assert false
1373
1373
in
1374
- let decl = new_local_type jkind in
1374
+ let decl = new_local_type jkind ~jkind_annot: None in
1375
1375
let name = existential_name cstr existential in
1376
1376
let (id, new_env) =
1377
1377
Env. enter_type (get_new_abstract_name ! env name) decl ! env
@@ -2613,7 +2613,7 @@ let reify env t =
2613
2613
let fresh_constr_scope = get_gadt_equations_level () in
2614
2614
let create_fresh_constr lev name jkind =
2615
2615
let name = match name with Some s -> " $'" ^ s | _ -> " $" in
2616
- let decl = new_local_type jkind in
2616
+ let decl = new_local_type jkind ~jkind_annot: None in
2617
2617
let (id, new_env) =
2618
2618
Env. enter_type (get_new_abstract_name ! env name) decl ! env
2619
2619
~scope: fresh_constr_scope in
@@ -2975,7 +2975,8 @@ let jkind_of_abstract_type_declaration env p =
2975
2975
which guards the case of unify3 that reaches this function. Would be
2976
2976
nice to eliminate the duplication, but is seems tricky to do so without
2977
2977
complicating unify3. *)
2978
- (Env. find_type p env).type_jkind
2978
+ let typ = Env. find_type p env in
2979
+ typ.type_jkind, typ.type_jkind_annotation
2979
2980
with
2980
2981
Not_found -> assert false
2981
2982
@@ -3015,10 +3016,13 @@ let add_gadt_equation env source destination =
3015
3016
(* Recording the actual jkind here is required, not just for efficiency.
3016
3017
When we check the jkind later, we may not be able to see the local
3017
3018
equation because of its scope. *)
3018
- let jkind = jkind_of_abstract_type_declaration ! env source in
3019
+ let jkind, jkind_annot =
3020
+ jkind_of_abstract_type_declaration ! env source
3021
+ in
3019
3022
add_jkind_equation ~reason: (Gadt_equation source) env destination jkind;
3020
3023
let decl =
3021
3024
new_local_type ~manifest_and_scope: (destination, expansion_scope) jkind
3025
+ ~jkind_annot
3022
3026
in
3023
3027
env := Env. add_local_type source decl ! env;
3024
3028
cleanup_abbrev ()
0 commit comments