Skip to content

Commit a04fc56

Browse files
committed
an attempt: thread through *all* unbound type vars
1 parent a8a36cc commit a04fc56

File tree

2 files changed

+11
-6
lines changed

2 files changed

+11
-6
lines changed

typing/jkind.ml

+4-5
Original file line numberDiff line numberDiff line change
@@ -1112,8 +1112,8 @@ module Layout_and_axes = struct
11121112
match jkind_of_type wb_ty with
11131113
| None -> Mod_bounds.max
11141114
| Some jkind ->
1115-
(!normalize' jkind (* CR aspsmith: unbound_type_vars? *)
1116-
~mode:Ignore_best ~jkind_of_type)
1115+
(!normalize' jkind ~unbound_type_vars ~mode:Ignore_best
1116+
~jkind_of_type)
11171117
.jkind
11181118
.mod_bounds
11191119
in
@@ -2318,13 +2318,12 @@ let for_object =
23182318
(******************************)
23192319
(* elimination and defaulting *)
23202320

2321-
let[@inline] normalize ?(unbound_type_vars = Btype.TypeSet.empty) ~mode
2322-
~jkind_of_type t =
2321+
let[@inline] normalize ?unbound_type_vars ~mode ~jkind_of_type t =
23232322
let mode : _ Layout_and_axes.normalize_mode =
23242323
match mode with Require_best -> Require_best | Ignore_best -> Ignore_best
23252324
in
23262325
let jkind, fuel_result =
2327-
Layout_and_axes.normalize ~unbound_type_vars ~jkind_of_type
2326+
Layout_and_axes.normalize ?unbound_type_vars ~jkind_of_type
23282327
~skip_axes:Axis_set.empty ~mode t.jkind
23292328
in
23302329
{ t with

typing/typedecl.ml

+7-1
Original file line numberDiff line numberDiff line change
@@ -2759,14 +2759,20 @@ let check_redefined_unit (td: Parsetree.type_declaration) =
27592759

27602760
(* Normalize the jkinds in a list of (potentially mutually recursive) type declarations *)
27612761
let normalize_decl_jkinds env shapes decls =
2762+
let unbound_type_vars =
2763+
List.fold_left
2764+
(fun acc (_, _, _, decl) ->
2765+
Btype.TypeSet.union acc (Datarepr.unbound_type_vars decl))
2766+
Btype.TypeSet.empty
2767+
decls
2768+
in
27622769
let rec normalize_decl_jkind env original_decl allow_any_crossing decl path =
27632770
let type_unboxed_version =
27642771
Option.map (fun type_unboxed_version ->
27652772
normalize_decl_jkind env (Option.get original_decl.type_unboxed_version)
27662773
allow_any_crossing type_unboxed_version (Path.unboxed_version path))
27672774
decl.type_unboxed_version
27682775
in
2769-
let unbound_type_vars = Datarepr.unbound_type_vars decl in
27702776
let normalized_jkind =
27712777
Jkind.normalize
27722778
~unbound_type_vars

0 commit comments

Comments
 (0)