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

fix: typespec for Spitfire.Env #43

Merged
merged 1 commit into from
Jun 17, 2024
Merged

fix: typespec for Spitfire.Env #43

merged 1 commit into from
Jun 17, 2024

Conversation

mhanberg
Copy link
Contributor

Fixes #42

cc @zachdaniel - try this branch out and let me know if it works for you, then I'll merge and publish a patch.

@zachdaniel
Copy link
Contributor

It doesn't appear to work for me.

lib/code/common.ex:200:pattern_match
The pattern can never match the type.

Pattern:
{:ok, _env}

Type:

  :error
  | %{:attrs => [any()], :functions => _, :macros => _, :variables => [any()], _ => _}


________________________________________________________________________________
lib/code/common.ex:221:unused_fun
Function use_alias/2 will never be called.
________________________________________________________________________________
lib/code/common.ex:594:pattern_match
The pattern can never match the type.

Pattern:
{:ok, _env}

Type:

  :error
  | %{:attrs => [any()], :functions => _, :macros => _, :variables => [any()], _ => _}


________________________________________________________________________________
done (warnings were emitted)
Halting VM with exit status 2

@zachdaniel
Copy link
Contributor

wait, hang on, sorry, I tested main not this branch 🤦

@zachdaniel
Copy link
Contributor

Ah, okay so I do still have an error, but the error is essentially on my end. The basic issue is that this env is technically safe to pass to expand_alias, but dialyzer still complains 😆 so I will do something like struct!(Macro.Env, spitfire_cursor_env)

@zachdaniel
Copy link
Contributor

Yep, looks good to me 👍 The type is accurately reflecting the return, and struct(Macro.Env, spitfire_cursor_env) satisfies everything else 👍

@mhanberg mhanberg merged commit 781c108 into main Jun 17, 2024
35 checks passed
@mhanberg mhanberg deleted the add-better-types branch June 17, 2024 11:55
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 this pull request may close these issues.

Spitfire.Env.expand/2 invalid typespec
2 participants