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

Spitfire.Env.expand/2 invalid typespec #42

Closed
zachdaniel opened this issue Jun 14, 2024 · 0 comments · Fixed by #43
Closed

Spitfire.Env.expand/2 invalid typespec #42

zachdaniel opened this issue Jun 14, 2024 · 0 comments · Fixed by #43

Comments

@zachdaniel
Copy link
Contributor

Its currently specced like so:

  @spec expand(Macro.t(), String.t()) ::
          {ast :: Macro.t(), final_state :: map(), final_env :: Macro.Env.t(), cursor_env :: Macro.Env.t()}

I have a function that returns the 3rd element from that tuple, also saying that it is a Macro.Env.t(). However, it isn't actually returning a Macro.Env.t() as far as I can tell, but a map with the same keys and some additional keys, w/o the struct? Not sure. But to address it on my end I did this:

    |> then(fn value ->
      # makes dialyzer happy?
      {:ok, Map.take(value, Map.keys(%Macro.Env{}))}
    end)

I don't know if that just breaks its inference or actually fixes anything though 😆

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

Successfully merging a pull request may close this issue.

1 participant