Skip to content

Commit 4f1468f

Browse files
committed
wip
1 parent cd9603f commit 4f1468f

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

src/typechecker.erl

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -361,10 +361,22 @@ compat_ty({type, _, 'fun', [{type, _, product, Args1}, Res1]},
361361
{Aps, constraints:combine(Cs, Css, Env)};
362362

363363
%% Unions
364-
compat_ty({type, _, union, _} = U1, {type, _, union, _} = U2, Seen, Env) ->
365-
case type_diff(U1, U2, Env) of
366-
?type(none) -> ret(Seen);
367-
_ -> throw(nomatch)
364+
compat_ty({type, _, union, Tys1} = U1, {type, _, union, Tys2} = U2, Seen, Env) ->
365+
IsAny = fun
366+
(?type(any)) -> true;
367+
(_) -> false
368+
end,
369+
case lists:any(IsAny, Tys1) of
370+
true -> ret(Seen);
371+
false ->
372+
case lists:any(IsAny, Tys2) of
373+
true -> ret(Seen);
374+
false ->
375+
case type_diff(U1, U2, Env) of
376+
?type(none) -> ret(Seen);
377+
_ -> throw(nomatch)
378+
end
379+
end
368380
end;
369381
compat_ty(Ty1, {type, _, union, Tys2}, Seen, Env) ->
370382
any_type(Ty1, Tys2, Seen, Env);

0 commit comments

Comments
 (0)