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

Support the record/2 macro in typespecs #116

Open
Qqwy opened this issue May 29, 2022 · 1 comment
Open

Support the record/2 macro in typespecs #116

Qqwy opened this issue May 29, 2022 · 1 comment

Comments

@Qqwy
Copy link
Owner

Qqwy commented May 29, 2022

Some archaic erlang types (c.f. :file.fd()) are parsed by elixir's typespec as, for instance, record(:file_descriptor).

It would be nice if we could support these directly in TypeCheck as well.

c.f. https://hexdocs.pm/elixir/Record.html#module-types

@Qqwy
Copy link
Owner Author

Qqwy commented May 29, 2022

  • record(SomeName, a: type1, b: type2) should be shorthand for {SomeName, a :: type1, b :: type2}
  • record(SomeName) should be shorthand for SomeName | {SomeName} | {SomeName, any()} | ... (in other words: val when val == SomeName or is_tuple(val) and elem(val, 0) == SomeName)

@Qqwy Qqwy added this to the Some future version milestone Oct 15, 2022
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

1 participant