Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions lib/elixir/lib/module/types/apply.ex
Original file line number Diff line number Diff line change
Expand Up @@ -1099,6 +1099,13 @@ defmodule Module.Types.Apply do
end
end

defp remote_apply(:erlang, :send, info, [_dest, message] = args_types, stack) do
case remote_apply(info, args_types, stack) do
{:ok, _type} -> {:ok, return(message, args_types, stack)}
other -> other
end
end

defp remote_apply(:erlang, :tl, _info, [list], stack) do
case list_tl(list) do
{:ok, value_type} -> {:ok, return(value_type, [list], stack)}
Expand Down
7 changes: 7 additions & 0 deletions lib/elixir/test/elixir/module/types/expr_test.exs
Original file line number Diff line number Diff line change
Expand Up @@ -444,6 +444,13 @@ defmodule Module.Types.ExprTest do
) == dynamic(tuple([integer(), integer(), binary()]))
end

test "send returns the message" do
assert typecheck!(send(self(), {:msg, 1})) == tuple([atom([:msg]), integer()])

assert typeerror!(send(123, {:msg, 1})) =~
"incompatible types given to Kernel.send/2"
end

test "undefined function warnings" do
assert typewarn!(URI.unknown("foo")) ==
{dynamic(), "URI.unknown/1 is undefined or private"}
Expand Down
Loading