Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Crash in gradualizer_fmt:format_type_error: no function_clause_matching #544

Open
RobinMorisset opened this issue Jun 7, 2023 · 0 comments
Labels

Comments

@RobinMorisset
Copy link

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)
@erszcz erszcz added the bug label Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants