Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Update Dialyzer so that functions
that construct bad records are not
treated as
no_return
ing.Constructing a record in a way that
doesn't match the type signature is
never a runtime error.
By having Dialyzer reflect this behavior,
we can avoid false positives
and helps find real bugs.
For example, before this change, running
Dialyzer on the code below would produce
4 false positives before the user sees
a meaningful warnings. And any
genuine bugs after the bad record
construction were hidden:
-record(rec, {field :: float() }).
a() -> b().
b() -> c().
c() -> d().
d() ->
#rec{field = 3},
% ... more code here
ok.
sample.erl:6: Function a/0 has no local return
sample.erl:7: Function b/0 has no local return
sample.erl:8: Function c/0 has no local return
sample.erl:9: Function d/0 has no local return
sample.erl:9: Record construction
#rec{field :: 3} violates the declared type of field field ::
float()
With this change, only a single warning is shown
when there are no more discrepancies in d/0.