Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
build_as_type: document why generic_instance can't be used (#9983)
  • Loading branch information
trefis committed Oct 20, 2020
1 parent 1e07bc7 commit 10364b6
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions typing/typecore.ml
Expand Up @@ -482,6 +482,11 @@ let rec build_as_type env p =
match extra with
| Tpat_type _ | Tpat_open _ | Tpat_unpack -> as_ty
| Tpat_constraint cty ->
(* [generic_instance] can only be used if the variables of the original
type ([cty.ctyp_type] here) are not at [generic_level], which they are
here.
If we used [generic_instance] we would lose the sharing between
[instance ty] and [ty]. *)
begin_def ();
let ty = instance cty.ctyp_type in
end_def ();
Expand Down

0 comments on commit 10364b6

Please sign in to comment.