Skip to content

Commit 22467ab

Browse files
authored
Do not use Access protocol on values that may be structs (#14532)
1 parent 360c239 commit 22467ab

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/elixir/lib/exception.ex

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2541,7 +2541,7 @@ defmodule ErlangError do
25412541
is_map(module) and is_atom(function) and is_map_key(module, function) ->
25422542
"you attempted to apply a function named #{inspect(function)} on a map/struct. " <>
25432543
"If you are using Kernel.apply/3, make sure the module is an atom. " <>
2544-
if is_function(module[function]) do
2544+
if is_function(Map.get(module, function)) do
25452545
"If you are trying to invoke an anonymous function in a map/struct, " <>
25462546
"add a dot between the function name and the parenthesis: map.#{function}.()"
25472547
else

0 commit comments

Comments
 (0)