Skip to content

Commit b056c36

Browse files
committed
proper jkind reason
1 parent 582f60b commit b056c36

File tree

3 files changed

+9
-1
lines changed

3 files changed

+9
-1
lines changed

ocaml/typing/jkind.ml

+6
Original file line numberDiff line numberDiff line change
@@ -629,6 +629,8 @@ type any_creation_reason =
629629
| Dummy_jkind
630630
| Type_expression_call
631631
| Inside_of_Tarrow
632+
| Wildcard
633+
| Unification_var
632634

633635
type float64_creation_reason = Primitive of Ident.t
634636

@@ -988,6 +990,8 @@ end = struct
988990
| Type_expression_call ->
989991
fprintf ppf "a call to [type_expression] via the ocaml API"
990992
| Inside_of_Tarrow -> fprintf ppf "argument or result of a Tarrow"
993+
| Wildcard -> fprintf ppf "a _ in a type"
994+
| Unification_var -> fprintf ppf "a fresh unification variable"
991995

992996
let format_immediate_creation_reason ppf : immediate_creation_reason -> _ =
993997
function
@@ -1359,6 +1363,8 @@ module Debug_printers = struct
13591363
| Dummy_jkind -> fprintf ppf "Dummy_jkind"
13601364
| Type_expression_call -> fprintf ppf "Type_expression_call"
13611365
| Inside_of_Tarrow -> fprintf ppf "Inside_of_Tarrow"
1366+
| Wildcard -> fprintf ppf "Wildcard"
1367+
| Unification_var -> fprintf ppf "Unification_var"
13621368

13631369
let immediate_creation_reason ppf : immediate_creation_reason -> _ = function
13641370
| Empty_record -> fprintf ppf "Empty_record"

ocaml/typing/jkind.mli

+2
Original file line numberDiff line numberDiff line change
@@ -256,6 +256,8 @@ type any_creation_reason =
256256
unified to correct levels *)
257257
| Type_expression_call
258258
| Inside_of_Tarrow
259+
| Wildcard
260+
| Unification_var
259261

260262
type float64_creation_reason = Primitive of Ident.t
261263

ocaml/typing/typetexp.ml

+1-1
Original file line numberDiff line numberDiff line change
@@ -432,7 +432,7 @@ end = struct
432432

433433
let new_jkind ~is_named { jkind_initialization } =
434434
match jkind_initialization with
435-
| Any -> Jkind.any ~why:Dummy_jkind
435+
| Any -> Jkind.any ~why:(if is_named then Unification_var else Wildcard)
436436
| Sort -> Jkind.of_new_sort ~why:(if is_named then Unification_var else Wildcard)
437437

438438

0 commit comments

Comments
 (0)