File tree Expand file tree Collapse file tree 1 file changed +11
-3
lines changed
Expand file tree Collapse file tree 1 file changed +11
-3
lines changed Original file line number Diff line number Diff line change @@ -2864,9 +2864,17 @@ and type_expect_ ?deprecated_context ~context ?in_function ?(recarg = Rejected)
28642864 let index =
28652865 type_expect ~context: None env sindex (instance_def Predef. type_int)
28662866 in
2867- let element_type = newgenvar () in
2868- let array_type = instance_def (Predef. type_array element_type) in
2869- unify_exp ~context: None env container array_type;
2867+ (* Extract element type from container to preserve arity information *)
2868+ let element_type =
2869+ match (expand_head env container.exp_type).desc with
2870+ | Tconstr (Pident {name = "array" } , [element_ty ], _ ) -> element_ty
2871+ | _ ->
2872+ (* Fallback: create fresh type variable and unify *)
2873+ let element_type = newgenvar () in
2874+ let array_type = instance_def (Predef. type_array element_type) in
2875+ unify_exp ~context: None env container array_type;
2876+ element_type
2877+ in
28702878 let value = type_expect ~context: None env svalue element_type in
28712879 rue
28722880 {
You can’t perform that action at this time.
0 commit comments