Skip to content

Commit 3c7ee9f

Browse files
committed
Handle empty function type in fun_apply
Closes #15486.
1 parent 51dce31 commit 3c7ee9f

2 files changed

Lines changed: 4 additions & 0 deletions

File tree

lib/elixir/lib/module/types/descr.ex

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1560,6 +1560,9 @@ defmodule Module.Types.Descr do
15601560
{:badarity, [arity | other]}
15611561
end
15621562

1563+
:badfun when fun_dynamic == nil ->
1564+
:badfun
1565+
15631566
:badfun ->
15641567
# No static arrows: dynamic-only path. Mixed-arity in the dynamic
15651568
# component is fine — we pick the matching-arity arrows and the

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1197,6 +1197,7 @@ defmodule Module.Types.DescrTest do
11971197
test "non funs" do
11981198
assert fun_apply(term(), [integer()]) == :badfun
11991199
assert fun_apply(integer(), [integer()]) == :badfun
1200+
assert fun_apply(none(), [integer()]) == :badfun
12001201
assert fun_apply(union(integer(), none_fun(1)), [integer()]) == :badfun
12011202
assert fun_apply(union(integer(), fun([integer()], atom())), [integer()]) == :badfun
12021203
assert fun_apply(union(integer(), dynamic()), [integer()]) == :badfun

0 commit comments

Comments
 (0)