Skip to content

Commit 0d39428

Browse files
committed
an attempt: thread through *all* unbound type vars
1 parent ead8bcf commit 0d39428

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
@@ -2235,13 +2235,12 @@ let for_object =
22352235
(******************************)
22362236
(* elimination and defaulting *)
22372237

2238-
let[@inline] normalize ?(unbound_type_vars = Btype.TypeSet.empty) ~mode
2239-
~jkind_of_type t =
2238+
let[@inline] normalize ?unbound_type_vars ~mode ~jkind_of_type t =
22402239
let mode : _ Layout_and_axes.normalize_mode =
22412240
match mode with Require_best -> Require_best | Ignore_best -> Ignore_best
22422241
in
22432242
let jkind, fuel_result =
2244-
Layout_and_axes.normalize ~unbound_type_vars ~jkind_of_type
2243+
Layout_and_axes.normalize ?unbound_type_vars ~jkind_of_type
22452244
~skip_axes:Axis_set.empty ~mode t.jkind
22462245
in
22472246
{ t with

typing/typedecl.ml

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

26572657
(* Normalize the jkinds in a list of (potentially mutually recursive) type declarations *)
26582658
let normalize_decl_jkinds env shapes decls =
2659+
let unbound_type_vars =
2660+
List.fold_left
2661+
(fun acc (_, _, _, decl) ->
2662+
Btype.TypeSet.union acc (Datarepr.unbound_type_vars decl))
2663+
Btype.TypeSet.empty
2664+
decls
2665+
in
26592666
let rec normalize_decl_jkind env original_decl allow_any_crossing decl path =
26602667
let type_unboxed_version =
26612668
Option.map (fun type_unboxed_version ->
26622669
normalize_decl_jkind env (Option.get original_decl.type_unboxed_version)
26632670
allow_any_crossing type_unboxed_version (Path.unboxed_version path))
26642671
decl.type_unboxed_version
26652672
in
2666-
let unbound_type_vars = Datarepr.unbound_type_vars decl in
26672673
let normalized_jkind =
26682674
Jkind.normalize
26692675
~unbound_type_vars

0 commit comments

Comments
 (0)