Hello, I’m seeing 2 new dialyzer warnings in my app that uses cowboy on 26.0 that weren’t there on 25.3:
_build/default/lib/cowboy/src/cowboy_req.erl
Line 134 Column 9: Unknown type ranch:ref/0
Line 152 Column 18: Unknown type ranch_proxy_header:proxy_info/0
Digging further into this, I see that with the Erlang/OTP 26 a new version of Dialyzer 5.1 was released. According to its release notes a backward incompatible change was introduced to enable unknown option by default.
Dialyzer has enabled (by default) warnings about unknown types and functions.
Prior to this change, Dialyzer had warnings about unknown types and functions disabled (by default).
This default value has been overwritten; Dialyzer now warns about unknown types and functions (as requested by the community in GH-5695).
So it seems like the options are
Add Dialyzer option no_unknown to the project to disable the unknown types and functions checks to restore previous behavior.
Manually add problematic dependencies that aren’t automatically included in the PLT such as {plt_extra_apps, [ranch]}.
Add Dialyzer option {plt_apps, all_deps} to the project.
I would like to take advantage of the new default, so I’m not inclined to do (1), but it’s interesting that the default behavior was changed that might seemingly result in violation of the principle of the least astonishment.
So, assuming the above assessment is correct, is (2) or (3) or another I don’t know about the recommended path forward?
Thanks for the reply. In this case, the type definitions and exports are already there, as I linked them in the original post. The problem seems to be that Dialyzer doesn’t seem to know which apps need to be in the PLT (2nd level dependencies?) and their absence is exposed via the warnings produced due to making the unknown check on by default. In fact, I’m actually not sure why I only see the 2 warnings I reported and not many many more. Part of me suspects there’s a subtle bug somewhere but .
I’m also inclined to go with option (2) just because, at least in my case, the project is small enough that I can take it on case by case basis, and option (3) makes the check take noticeably, like 7x, longer time.