josefs/Gradualizer

function_clause crash in typechecker:get_unassigned_fields/2

jesperes opened this issue · 2 comments

Another function_clause error:

Error: function_clause
[{lists,map,
        [#Fun<typechecker.21.54609745>,{type,0,any,[]}],
        [{file,"lists.erl"},{line,1242}]},
 {typechecker,get_unassigned_fields,2,
              [{file,"/home/jespereskilson/dev/kred/_build/default/plugins/gradualizer/src/typechecker.erl"},
               {line,2013}]},
 {typechecker,type_check_fields,3,
              [{file,"/home/jespereskilson/dev/kred/_build/default/plugins/gradualizer/src/typechecker.erl"},
               {line,1964}]},
 {typechecker,type_check_record_union_in,3,
              [{file,"/home/jespereskilson/dev/kred/_build/default/plugins/gradualizer/src/typechecker.erl"},
               {line,3348}]},
 {typechecker,do_type_check_expr_in,3,
              [{file,"/home/jespereskilson/dev/kred/_build/default/plugins/gradualizer/src/typechecker.erl"},
               {line,2496}]},
 {typechecker,type_check_expr_in,3,
              [{file,"/home/jespereskilson/dev/kred/_build/default/plugins/gradualizer/src/typechecker.erl"},
               {line,2325}]},
 {typechecker,type_check_block_in,3,
              [{file,"/home/jespereskilson/dev/kred/_build/default/plugins/gradualizer/src/typechecker.erl"},
               {line,3310}]},
 {typechecker,check_clause,5,
              [{file,"/home/jespereskilson/dev/kred/_build/default/plugins/gradualizer/src/typechecker.erl"},
               {line,3586}]}]

Last message from Gradualizer when using verbose:

97: Checking that PaccErrInfo#pacc_err_info{err = {OrigErr, Where}} :: #pacc_err_info{} | any()
Task reported error with trace from function parse_modified_error/1

The function parse_modified_error/1 looks like this:

-spec parse_modified_error(Error :: any()) -> #pacc_err_info{} | any().
parse_modified_error({{nocatch, PaccErrInfo = #pacc_err_info{}}, Where}) ->
    OrigErr = PaccErrInfo#pacc_err_info.err,
    PaccErrInfo#pacc_err_info{err = {OrigErr, Where}};
parse_modified_error(PaccErrInfo = #pacc_err_info{}) ->
    PaccErrInfo;
parse_modified_error({PaccErrInfo = #pacc_err_info{}, Where}) ->
    OrigErr = PaccErrInfo#pacc_err_info.err,
    PaccErrInfo#pacc_err_info{err = {OrigErr, Where}};
parse_modified_error(Reason) ->
    Reason.

Gradualizer version: 136f1ba

Confirming that #447 fixes this issue.

Thanks, @jesperes!