Skip to content

Conversation

josevalim
Copy link
Member

This branch adds inference of patterns for all supported types, except lists which are yet to be implemented.

Before merging, we need to detect recursive definitions, as currently the type inference algorithm never completes for those.

dynamic(non_empty_list(integer()))

assert typecheck!([x = [1, 2, 3 | y], y = :foo], x) ==
dynamic(non_empty_list(integer(), atom([:foo])))
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it an expected type for improper lists?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes!

@josevalim josevalim merged commit 860f485 into main Oct 18, 2024
18 checks passed
@josevalim josevalim deleted the jv-pattern-inference branch October 18, 2024 09:01
@josevalim
Copy link
Member Author

💚 💙 💜 💛 ❤️

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.

4 participants