Crash in gradualizer_fmt:format_type_error: no function_clause_matching
Opened this issue · 0 comments
RobinMorisset commented
Running gradualizer on the following erlang code:
-export([f/0]).
f() ->
fun() when is_list(undefined) ->
ok
end.
f(#{(ok#{ok := ok}) := _}) ->
ok.
results in the following crash:
/home/rmorisset/minimized/test374.erl: escript: exception error: no function clause matching
gradualizer_fmt:format_type_error({illegal_pattern,
{map,
{12,8},
{atom,{12,6},ok},
[{map_field_exact,
{12,13},
{atom,{12,10},ok},
{atom,{12,16},ok}}]}},
[{source_file,
"/home/rmorisset/minimized/test374.erl"},
{filename,
"/home/rmorisset/minimized/test374.erl"},
{forms,
[{attribute,
{1,1},
file,
{"/home/rmorisset/minimized/test374.erl",
1}},
{attribute,
{4,2},
module,test374},
{attribute,
{5,2},
export,
[{f,0}]},
{function,
{7,1},
f,0,
[{clause,
{7,1},
[],[],
[{'fun',
{8,5},
{clauses,
[{clause,
{8,8},
[],
[[{call,
{8,16},
{atom,
{8,16},
is_list},
[{atom,
{8,24},
undefined}]}]],
[{atom,
{9,9},
ok}]}]}}]}]},
{function,
{12,1},
f,1,
[{clause,
{12,1},
[{map,
{12,3},
[{map_field_exact,
{12,21},
{map,
{12,8},
{atom,{12,6},ok},
[{map_field_exact,
{12,13},
{atom,
{12,10},
ok},
{atom,
{12,16},
ok}}]},
{var,
{12,24},
'_'}}]}],
[],
[{atom,{13,5},ok}]}]},
{eof,{14,1}}]}]) (src/gradualizer_fmt.erl, line 50)
in function gradualizer_fmt:handle_type_error/2 (src/gradualizer_fmt.erl, line 532)
in call from gradualizer_fmt:'-print_errors/2-lc$^0/1-0-'/2 (src/gradualizer_fmt.erl, line 518)
in call from gradualizer_fmt:print_errors/2 (src/gradualizer_fmt.erl, line 518)
in call from gradualizer:type_check_forms/3 (src/gradualizer.erl, line 326)
in call from gradualizer:'-type_check_files/2-fun-1-'/4 (src/gradualizer.erl, line 276)
in call from lists:foldl/3 (lists.erl, line 1350)
in call from gradualizer_cli:main/1 (src/gradualizer_cli.erl, line 17)