Open erszcz opened 3 months ago
The following module, modelled after Gradualizer code dealing with type() instances:
type()
-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
The following module, modelled after Gradualizer code dealing with
type()
instances:Fails with:
Gradualizer commit: 81385f6