Skip to content

Commit

Permalink
Stop checking manifest jkind against inferred
Browse files Browse the repository at this point in the history
  • Loading branch information
liam923 authored and glittershark committed Jan 30, 2025
1 parent 8a3bb22 commit a1afe21
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions typing/typedecl.ml
Original file line number Diff line number Diff line change
Expand Up @@ -1233,9 +1233,18 @@ let check_constraints env sdecl (_, decl) =
immediate, we should check the manifest is immediate). Also, update the
resulting jkind to match the manifest. *)
let narrow_to_manifest_jkind env loc decl =
match decl.type_manifest with
| None -> decl
| Some ty ->
match decl.type_manifest, decl.type_kind with
| None, _ -> decl
| Some _, (Type_record _ | Type_record_unboxed_product _ | Type_variant _ | Type_open)
when not (Builtin_attributes.has_or_null_reexport decl.type_attributes)
->
(* If there's both a manifest and a kind, there's no reason to check that the jkind
of the manifest matches the annotation. This is because the manifest's jkind is
exactly the kind's jkind, which has already been checked against the annotation.
The annotation has also been narrowed based on the kind's jkind, so there's no
reason to update the jkind either. *)
decl
| Some ty, _ ->
(* CR layouts v2.8: Remove this use of [type_jkind_purely], which is slow
and effectful. But we cannot do so easily, sadly. I tried using
[estimate_type_jkind] here instead, but this runs aground with mutually
Expand Down

0 comments on commit a1afe21

Please sign in to comment.