Skip to content

Commit 915cf36

Browse files
committed
Test: allow free vars in types for coercion.
See #6821 Free variables are not allowed in coercion, and if that happens, simple unification is performed without ever attempting coercion. This seems to go back a very long time. There's probably a good reason why free vars were not allowed. At the same time, there are no objects/classes supported in the language anymore, so it's not clear how those reasons would adapt. This just marks the place where one could investigate.
1 parent fcdf7a9 commit 915cf36

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

jscomp/ml/typecore.ml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2595,7 +2595,7 @@ and type_expect_ ?type_clash_context ?in_function ?(recarg=Rejected) env sexp ty
25952595
end else true
25962596
in
25972597
begin match arg.exp_desc, !self_coercion, (repr ty').desc with
2598-
| _ when free_variables ~env arg.exp_type = []
2598+
| _ when true || free_variables ~env arg.exp_type = []
25992599
&& free_variables ~env ty' = [] ->
26002600
if not gen && (* first try a single coercion *)
26012601
let snap = snapshot () in

0 commit comments

Comments
 (0)