Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Empty source AST #1896

Closed
williamthome opened this issue Apr 25, 2024 · 6 comments
Closed

Empty source AST #1896

williamthome opened this issue Apr 25, 2024 · 6 comments

Comments

@williamthome
Copy link

I have failling actions on this PR by running rebar3 ex_doc:

===> Running ex_doc for template_compiler
===> warning: the VM is running with native name encoding of latin1 which may cause Elixir to malfunction as it expects utf8. Please ensure your locale is set to UTF-8 (which can be verified by running "locale" in your shell) or set the ELIXIR_ERL_OPTIONS="+fnu" environment variable
** (ArgumentError) errors were found at the given arguments:

  * 1st argument: not a nonempty list

    :erlang.hd([])
    (ex_doc 0.31.2) lib/ex_doc/language/source.ex:2[19](https://github.com/zotonic/template_compiler/actions/runs/8827353833/job/24236586917?pr=48#step:8:20): ExDoc.Language.Source.find_ast/3
    (ex_doc 0.31.2) lib/ex_doc/language/erlang.ex:167: ExDoc.Language.Erlang.type_data/2
    (ex_doc 0.31.2) lib/ex_doc/retriever.ex:388: ExDoc.Retriever.get_type/5
    (ex_doc 0.31.2) lib/ex_doc/retriever.ex:378: anonymous fn/6 in ExDoc.Retriever.get_types/4
    (elixir 1.16.0) lib/enum.ex:[25](https://github.com/zotonic/template_compiler/actions/runs/8827353833/job/24236586917?pr=48#step:8:26)28: Enum."-reduce/3-lists^foldl/2-0-"/3
    (ex_doc 0.31.2) lib/ex_doc/retriever.ex:377: ExDoc.Retriever.get_types/4
    (ex_doc 0.31.2) lib/ex_doc/retriever.ex:155: ExDoc.Retriever.generate_node/3

===> 
make: *** [GNUmakefile:43: edoc] Error 1
Error: Process completed with exit code 2.

That's the line that is causing the error:

filtermap_ast(ast, source_basedir, fun) |> hd()

I did not look at why the AST it's empty or if it can be empty.

@josevalim
Copy link
Member

Either source file was compiled with debug_info or you have entries in your docs chunk for types that do not exist. In any case, we can likely improve the error message here.

@josevalim
Copy link
Member

I have improved the error messages on main. It may help pinpoint the root cause.

@williamthome
Copy link
Author

@josevalim how can I use the main version on this rebar.config file?

@wojtekmach
Copy link
Member

wojtekmach commented Apr 26, 2024

Please try:

{project_plugins, [{rebar3_ex_doc, {git, "git://github.com/starbelly/rebar3_ex_doc.git"}}]}.

@williamthome
Copy link
Author

Please try:

{project_plugins, [{rebar3_ex_doc, {git, "git://github.com/starbelly/rebar3_ex_doc.git"}}]}.

Hmm I think this is related to rebar3_ex_doc plugin and not to ex_doc itself.
I found this on rebar3 docs. Will try.
Thank you!

@williamthome
Copy link
Author

I'm closing this issue because now all checks have passed.
Thanks @josevalim @wojtekmach !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

No branches or pull requests

3 participants