-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
dialyzer_dataflow: Fix bug in bind_checked_inf/4
`unit` can't be bound any more than `none` can. This resulted in slightly improved analysis in some cases, taking notice of more functions in OTP that lacked a local return, so I've added specs to those functions in order to silence the warnings. The pattern for that is: ```erlang try function_that_returns_unit() catch _:_ -> error(xyz) end ``` Previously, this expression was treated as returning unit() even though it could only ever return none(), as the wrapped function would never return.
- Loading branch information
Showing
6 changed files
with
32 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
|
||
gh6580.erl:11:21: The pattern <[_ | _], _> can never match the type <[],<<>>> | ||
gh6580.erl:5:1: Function f/0 has no local return | ||
gh6580.erl:6:5: The created fun has no local return | ||
gh6580.erl:6:5: The pattern <[], _> can never match the type <<<>>,<<>>> | ||
gh6580.erl:6:5: The pattern <[_ | _], _> can never match the type <<<>>,<<>>> | ||
gh6580.erl:9:13: Fun application with arguments (<<>>,<<>>) will never return since it differs in the 1st argument from the success typing arguments: ([],any()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
-module(gh6580). | ||
-export([f/0]). | ||
|
||
%% GH-6580: dialyzer would crash when binding an impossible cons. | ||
f() -> | ||
<< | ||
0 | ||
|| _ <- | ||
case ok of | ||
X -> | ||
<<0 || _ <- []>> | ||
end, | ||
X <- 0, | ||
#{X := Y} <- 0 | ||
>>. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters