diff --git a/lib/ex_doc/retriever.ex b/lib/ex_doc/retriever.ex index 8e14a033b..d2c297ec6 100644 --- a/lib/ex_doc/retriever.ex +++ b/lib/ex_doc/retriever.ex @@ -249,7 +249,14 @@ defmodule ExDoc.Retriever do (source_doc && doc_ast(content_type, source_doc, file: source.path, line: doc_line + 1)) || function_data.doc_fallback.() - group = GroupMatcher.match_function(groups_for_docs, metadata) + group = + GroupMatcher.match_function( + groups_for_docs, + Map.merge( + %{kind: type, name: name, arity: arity, module: module_data.module}, + metadata + ) + ) %ExDoc.FunctionNode{ id: nil_or_name(name, arity), @@ -323,7 +330,15 @@ defmodule ExDoc.Retriever do doc_ast = doc_ast(content_type, source_doc, file: source.path, line: doc_line + 1) metadata = Map.put(metadata, :__doc__, :callback) - group = GroupMatcher.match_function(groups_for_docs, metadata) + + group = + GroupMatcher.match_function( + groups_for_docs, + Map.merge( + %{kind: kind, name: name, arity: arity, module: module_data.module}, + metadata + ) + ) %ExDoc.FunctionNode{ id: "c:" <> nil_or_name(name, arity), @@ -355,7 +370,7 @@ defmodule ExDoc.Retriever do defp get_type(type_entry, source, groups_for_docs, module_data, annotations_for_docs) do {:docs_v1, _, _, content_type, _, module_metadata, _} = module_data.docs - {{_, name, arity}, anno, _signature, source_doc, metadata} = type_entry + {{kind, name, arity}, anno, _signature, source_doc, metadata} = type_entry doc_line = anno_line(anno) source = anno_file(anno, source) annotations = annotations_from_metadata(metadata, module_metadata) @@ -369,7 +384,15 @@ defmodule ExDoc.Retriever do doc_ast = doc_ast(content_type, source_doc, file: source.path, line: doc_line + 1) metadata = Map.put(metadata, :__doc__, :type) - group = GroupMatcher.match_function(groups_for_docs, metadata) + + group = + GroupMatcher.match_function( + groups_for_docs, + Map.merge( + %{kind: kind, name: name, arity: arity, module: module_data.module}, + metadata + ) + ) %ExDoc.TypeNode{ id: "t:" <> nil_or_name(name, arity),