diff --git a/lib/ex_doc/autolink.ex b/lib/ex_doc/autolink.ex index b31943078..047017270 100644 --- a/lib/ex_doc/autolink.ex +++ b/lib/ex_doc/autolink.ex @@ -288,9 +288,18 @@ defmodule ExDoc.Autolink do defp do_parse_module(string) do case Code.string_to_quoted(string, warn_on_unnecessary_quotes: false) do - {:ok, module} when is_atom(module) -> {:module, module} - {:ok, {:__aliases__, _, parts}} -> {:module, Module.concat(parts)} - _ -> :error + {:ok, module} when is_atom(module) -> + {:module, module} + + {:ok, {:__aliases__, _, parts}} -> + if Enum.all?(parts, &is_atom/1) do + {:module, Module.concat(parts)} + else + :error + end + + _ -> + :error end end diff --git a/test/ex_doc/autolink_test.exs b/test/ex_doc/autolink_test.exs index 0606031f3..3773f1706 100644 --- a/test/ex_doc/autolink_test.exs +++ b/test/ex_doc/autolink_test.exs @@ -33,6 +33,7 @@ defmodule ExDoc.AutolinkTest do test "unknown module" do assert_unchanged("Unknown") assert_unchanged(":unknown") + assert_unchanged("A.b.C") end test "project-local module" do