Skip to content

Conversation

@sabiwara
Copy link
Contributor

Closes #14927

I'm starting to dislike these fixes, especially because Dialyzer is unable to follow the real types of functions like Keyword.pop. No matter what function we call, returning a keyword will be enough for Dialyzer to give up checking keys altogether.

Calling Keyword.take before each call doesn't seem great, there's an extra performance cost for no reason since these functions don't care about the extra opts.
We might as well define "open keyword" types, like we do for format_opts (| {atom(), term()}), which correspond better to the real types of these functions (the downside is we can't catch typos in opts).

@sabiwara sabiwara force-pushed the format-string-dialyzer branch from 43b6976 to e710ace Compare November 20, 2025 00:02
locals_without_parens: true,
migrate: true
)
end
Copy link
Member

Choose a reason for hiding this comment

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

Good call, we can probably add the IO.inspect one here too!

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Oh yeah I initially meant to do that - done 5586241

@josevalim
Copy link
Member

Please back port it too!

@sabiwara sabiwara merged commit ae752c7 into elixir-lang:main Nov 20, 2025
13 checks passed
@sabiwara sabiwara deleted the format-string-dialyzer branch November 20, 2025 10:39
sabiwara added a commit that referenced this pull request Nov 20, 2025
* Fix dialyzer warning in Code.format_string!/2

Tentative fix for #14927

* Add regression test for IO.inspect/2 opts
@sabiwara
Copy link
Contributor Author

Backported ✅

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.

Dialyzer error on Code.format_string! in 1.19

2 participants