diff --git a/lib/elixir/lib/exception.ex b/lib/elixir/lib/exception.ex index 30c0e81908..654874a87d 100644 --- a/lib/elixir/lib/exception.ex +++ b/lib/elixir/lib/exception.ex @@ -727,7 +727,7 @@ defmodule ArgumentError do not is_atom(module) and is_atom(function) and args == [] -> "you attempted to apply #{inspect(function)} on #{inspect(module)}. " <> "If you are using apply/3, make sure the module is an atom. " <> - "If you are using the dot syntax, such as map.field or module.function, " <> + "If you are using the dot syntax, such as map.field or module.function(), " <> "make sure the left side of the dot is an atom or a map" not is_atom(module) -> @@ -986,7 +986,7 @@ defmodule UndefinedFunctionError do end defp hint(nil, _function, 0, _loaded?) do - ". If you are using the dot syntax, such as map.field or module.function, " <> + ". If you are using the dot syntax, such as map.field or module.function(), " <> "make sure the left side of the dot is an atom or a map" end diff --git a/lib/elixir/test/elixir/exception_test.exs b/lib/elixir/test/elixir/exception_test.exs index 54f178307d..df9d46bbcc 100644 --- a/lib/elixir/test/elixir/exception_test.exs +++ b/lib/elixir/test/elixir/exception_test.exs @@ -414,12 +414,12 @@ defmodule ExceptionTest do assert blame_message([], & &1.foo) == "you attempted to apply :foo on []. If you are using apply/3, make sure " <> "the module is an atom. If you are using the dot syntax, such as " <> - "map.field or module.function, make sure the left side of the dot is an atom or a map" + "map.field or module.function(), make sure the left side of the dot is an atom or a map" assert blame_message([], &apply(&1, :foo, [])) == "you attempted to apply :foo on []. If you are using apply/3, make sure " <> "the module is an atom. If you are using the dot syntax, such as " <> - "map.field or module.function, make sure the left side of the dot is an atom or a map" + "map.field or module.function(), make sure the left side of the dot is an atom or a map" assert blame_message([], &apply(Kernel, &1, [1, 2])) == "you attempted to apply [] on module Kernel. Functions (the second argument of apply) must always be an atom" @@ -464,7 +464,7 @@ defmodule ExceptionTest do test "annotates undefined function clause error with nil hints" do assert blame_message(nil, & &1.foo) == "function nil.foo/0 is undefined. If you are using the dot syntax, " <> - "such as map.field or module.function, make sure the left side of the dot is an atom or a map" + "such as map.field or module.function(), make sure the left side of the dot is an atom or a map" end test "annotates key error with suggestions if keys are atoms" do