Skip to content

Commit

Permalink
Print Erlang signatures not 'bad signature'
Browse files Browse the repository at this point in the history
  • Loading branch information
erszcz committed Mar 29, 2020
1 parent b127b16 commit 5981077
Showing 1 changed file with 7 additions and 6 deletions.
13 changes: 7 additions & 6 deletions lib/ex_doc/retriever.ex
Original file line number Diff line number Diff line change
Expand Up @@ -479,7 +479,7 @@ defmodule ExDoc.Retriever do
end

defp get_type(content_type, type, source, abst_code) do
{{_, name, arity}, anno, _, doc, metadata} = type
{{_, name, arity}, anno, erlang_signature, doc, metadata} = type

This comment has been minimized.

Copy link
@josevalim

josevalim Apr 5, 2020

For Elixir, the signature (erlang_signature here), will be an empty list. So instead of checking the file type, you can simply look at the signature instead. If it is an empty list, you get it from .beam/abstract code, otherwise you use the given signature. :)

doc_line = anno_line(anno)
annotations = annotations_from_metadata(metadata)

Expand All @@ -506,11 +506,12 @@ defmodule ExDoc.Retriever do
annotations = if type == :opaque, do: ["opaque" | annotations], else: annotations

signature =
try do
get_typespec_signature(spec, arity)
rescue
_ ->
"(bad signature)"
case Path.extname(source.path) do
".ex" ->
get_typespec_signature(spec, arity)

".erl" ->
Enum.join(erlang_signature, " ")
end

%ExDoc.TypeNode{
Expand Down

0 comments on commit 5981077

Please sign in to comment.