Skip to content

Commit 4b6fdb4

Browse files
committed
Add more tests around compatibility check
1 parent 7819a73 commit 4b6fdb4

File tree

1 file changed

+8
-1
lines changed

1 file changed

+8
-1
lines changed

lib/elixir/test/elixir/module/types/descr_test.exs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -826,14 +826,21 @@ defmodule Module.Types.DescrTest do
826826
assert fun_apply(fun([integer()], atom()), [integer()]) == {:ok, atom()}
827827
assert fun_apply(fun([integer()], atom()), [float()]) == {:badarg, [integer()]}
828828
assert fun_apply(fun([integer()], atom()), [term()]) == {:badarg, [integer()]}
829-
assert fun_apply(fun([integer()], atom()), [dynamic()]) == {:ok, dynamic()}
830829

830+
# Return types
831831
assert fun_apply(fun([integer()], none()), [integer()]) == {:ok, none()}
832832
assert fun_apply(fun([integer()], term()), [integer()]) == {:ok, term()}
833833

834834
# Dynamic args
835835
assert fun_apply(fun([term()], term()), [dynamic()]) == {:ok, term()}
836836

837+
assert fun_apply(fun([integer()], atom()), [dynamic(integer())])
838+
|> elem(1)
839+
|> equal?(atom())
840+
841+
assert fun_apply(fun([integer()], atom()), [dynamic(float())]) == {:badarg, [integer()]}
842+
assert fun_apply(fun([integer()], atom()), [dynamic(term())]) == {:ok, dynamic()}
843+
837844
# Arity mismatches
838845
assert fun_apply(fun([integer()], integer()), [term(), term()]) == {:badarity, [1]}
839846
assert fun_apply(fun([integer(), atom()], boolean()), [integer()]) == {:badarity, [2]}

0 commit comments

Comments
 (0)