elixir-tools / spitfire

Error tolerant parser for Elixir
https://www.elixir-tools.dev
MIT License
69 stars 7 forks source link

Spitfire doesn't handle unquote inside specs #11

Closed lucacervello closed 6 months ago

lucacervello commented 6 months ago

This snippet is handled just fine by Code.string_to_quoted/2 but Spitfire returns an error

defmodule Foo do
  @possible_results [:a, :b, :c]

  @type result_type ::
          unquote(
            for result <- @possible_results, reduce: [] do
              acc -> {:|, [], [result, acc]}
            end
          )
end
mhanberg commented 6 months ago

For posterity, the problem was a call with a do block couldn't be parsed inside a function call with parens

        type bar(
                foo do
                  a
                end
              )