-
Notifications
You must be signed in to change notification settings - Fork 37
Open
Labels
Description
The following module, modelled after Gradualizer code dealing with type() instances:
-module(exhaustivity_issue).
-export([g/1]).
-include("include/gradualizer.hrl").
-type simple_type() :: {type, list | nonempty_list, [a | simple_type()]}
| {type, atom, {b}}.
-spec g(simple_type()) -> b | simple_type().
g({type, list, []}) ->
b;
g({type, list, [a]}) ->
b;
g({type, nonempty_list, []}) ->
b;
g({type, nonempty_list, [a]}) ->
b;
g({type, list, [a, SimpleTy]}) ->
?assert_type(SimpleTy, simple_type());
g({type, atom, {_InnerNode}}) ->
b.Fails with:
$ ./bin/gradualizer exhaustivity_issue.erl
exhaustivity_issue.erl: Nonexhaustive patterns on line 11 at column 1
Example values which are not covered:
{type, nonempty_list, [a]}
Gradualizer commit: 81385f6