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 with (...) -> any(), closes #1974 #1980

Merged
merged 2 commits into from
Dec 15, 2024
Merged

Conversation

josevalim
Copy link
Member

@gomoripeti this is fixed in main but it will require Elixir v1.18+.

@garazdawi in the long term, we probably want the code that converts a typespec into a string with links to be part of Erlang/OTP? Perhaps by adding some sort of fallback to the existing pretty printing function? Or perhaps, instead of converting it to Elixir AST and traversing it, we'd traverse the Erlang AST typespec directly.

@josevalim josevalim merged commit 15f2f08 into main Dec 15, 2024
10 checks passed
@josevalim josevalim deleted the jv-typespec-1.18 branch December 15, 2024 16:11
@josevalim
Copy link
Member Author

💚 💙 💜 💛 ❤️

@garazdawi
Copy link
Contributor

Or perhaps, instead of converting it to Elixir AST and traversing it, we'd traverse the Erlang AST typespec directly.

I think this would be a better option. IIRC it should be possible to use erl_syntax_lib:fold to get something relatively close to what we have today.

@garazdawi
Copy link
Contributor

I found a regression with this change. If you do:

-spec foo(fun()) -> ok.

It will try to create a link for a local type called fun/0, while fun() is actually syntax (as opposed to function() which is more like a type()). Any ideas on how to solve this would be appreciated. I will work around it by replacing it with function() for now and will start digging to see if I can come up with a solution.

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

Successfully merging this pull request may close these issues.

2 participants