Skip to content

Fix autocomplete crash when expanding struct with __MODULE__ #14308

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

Merged
merged 2 commits into from
Mar 5, 2025

Conversation

lukaszsamson
Copy link
Contributor

This PR fixes

*** ERROR: Shell process terminated! (^G to start new job) ***

21:39:55.166 [error] Process #PID<0.70.0> raised an exception
** (FunctionClauseError) no function clause matching in Module.concat/2
    (elixir 1.18.2) lib/module.ex:961: Module.concat(Elixir, {:__MODULE__, [line: 1], nil})
    (iex 1.18.2) lib/iex/autocomplete.ex:471: IEx.Autocomplete.value_from_alias/2
    (iex 1.18.2) lib/iex/autocomplete.ex:422: IEx.Autocomplete.container_context_struct/4
    (iex 1.18.2) lib/iex/autocomplete.ex:334: IEx.Autocomplete.expand_container_context/4
    (iex 1.18.2) lib/iex/autocomplete.ex:82: IEx.Autocomplete.expand_code/2
    (kernel 9.2.4.6) group.erl:685: :group.get_line1/5
    (kernel 9.2.4.6) group.erl:517: :group.get_chars_loop/10
    (kernel 9.2.4.6) group.erl:213: :group.io_request/6
iex(1)> %__MODULE__.Sd{

@josevalim
Copy link
Member

Can we also have a test? Thank you!

@lukaszsamson
Copy link
Contributor Author

Sure. I thought it's not worth covering this case as completions do not return anything useful.

@josevalim
Copy link
Member

But given it raises, we should double check it at least returns nothing!

@lukaszsamson
Copy link
Contributor Author

Done

@josevalim josevalim merged commit 88605cf into elixir-lang:main Mar 5, 2025
10 checks passed
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

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

Successfully merging this pull request may close these issues.

2 participants