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

Invalid AST generated when quote block is in pipeline #82

Closed
SteffenDE opened this issue Oct 24, 2023 · 2 comments
Closed

Invalid AST generated when quote block is in pipeline #82

SteffenDE opened this issue Oct 24, 2023 · 2 comments

Comments

@SteffenDE
Copy link

Hi there, I'm running into a Styler and/or Elixir bug trying to format the code included in the LiveBook below.

Versions

  • Elixir: 1.15.7
  • Styler: 0.9.6

Example Input

See https://gist.github.com/SteffenDE/6d9d076a10cb802fc78356e6ff4212f2

Stacktrace / Current Behaviour

** (Protocol.UndefinedError) protocol Enumerable not implemented for nil of type Atom. This protocol is implemented for the following type(s): Date.Range, File.Stream, Function, GenEvent.Stream, HashDict, HashSet, IO.Stream, List, Map, MapSet, Range, Stream
    (elixir 1.15.5) lib/enum.ex:1: Enumerable.impl_for!/1
    (elixir 1.15.5) lib/enum.ex:166: Enumerable.reduce/3
    (elixir 1.15.5) lib/enum.ex:4387: Enum.map/2
    (elixir 1.15.5) lib/code/normalizer.ex:453: Code.Normalizer.normalize_kw_blocks/4
    (elixir 1.15.5) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
    (elixir 1.15.5) lib/enum.ex:1693: Enum."-map/2-lists^map/1-1-"/2
    (elixir 1.15.5) lib/code/normalizer.ex:387: Code.Normalizer.normalize_call/2
    #cell:xqr6v7wgxvcifsqmtk6ey3tu6afg6umg:1: (file)

Putting the quote block in a variable outside the pipeline fixes this issue. I think this may both be a styler and Elixir issue, as styler somehow creates invalid AST and Elixir does not give any helpful error / stacktrace.

@novaugust
Copy link
Contributor

thanks for the report! will find time this week for a fix (it'll probably just manually move the quote out of the pipe, like it does w/ case)

@novaugust
Copy link
Contributor

0.9.7 out w/ the fix. thx again for reporting ❤️

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

No branches or pull requests

2 participants