Skip to content

Add note about statically known maps keys and types tracking across function calls to the changelog #13562

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

Merged
merged 1 commit into from
May 15, 2024

Conversation

michallepicki
Copy link
Contributor

When reading the 1.17 changelog, in my opinion people less familiar with how typecheckers work can read too much into the promised improvements, and they might be disappointed afterwards when trying out the typechecker. For example, these two points especially:

Elixir v1.17 will emit the following warnings at compile-time:

  • Pattern matching against a map or a struct that does not have the given key, such as %{adress: ...} = user (notice address vs adress)
  • Updating a struct or a map that does not define the given key, such as %{user | adress: ...}

mention maps in general, but if I understand correctly this will only work for maps in limited situations when the map type with its keys is statically known, e.g. when updating a map literal defined in the same function.

I think it's better not to over-promise, so I would propose adding some kind of caveat / info mention about the current general limitations of how the typechecker works. This wording and the caveat placement is probably not very good, but I wanted to open the PR to illustrate what I meant

@josevalim josevalim merged commit f766078 into elixir-lang:main May 15, 2024
@josevalim
Copy link
Member

💚 💙 💜 💛 ❤️

@michallepicki michallepicki deleted the patch-9 branch May 15, 2024 07:45
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