If you add eqwalizer_support
dependency to your project (see the instructions in README - eqwalizer/README.md at main · WhatsApp/eqwalizer · GitHub) then your example
is accepted.
eqwalizer_support
ships a special module eqwalizer_specs
(eqwalizer/eqwalizer_support/src/eqwalizer_specs.erl at main · WhatsApp/eqwalizer · GitHub) that provide more accurate specs for some stdlib functions (especially “generic” functions like lists:foldl
).
Compare it to the OTP spec:
The original spec says that the result type is Acc1 :: term()
- note that Acc1
is not connected to any other type variables, so it’s just term()
.
There is an EEP - Eep 0071 - Erlang/OTP - bringing some clarification how type variables should be considered for type checking and there is a PR to make the lists
specs more accurate for type-checking - Update and uniformise lists specs by VLanvin · Pull Request #8736 · erlang/otp · GitHub.
There is also a task - add sanity check that eqwalizer_support is present · Issue #82 · WhatsApp/erlang-language-platform · GitHub - to add more signal about eqwalizer_specs
in CLI/UI.