diff options
Diffstat (limited to 'lib/compiler/src')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 12 | ||||
-rw-r--r-- | lib/compiler/src/v3_core.erl | 7 |
2 files changed, 9 insertions, 10 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 01e9987196..5cc7529469 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -897,8 +897,9 @@ fold_lit_args(Call, Module, Name, Args0) -> end catch error:Reason -> - %% Evaluation of the function failed. Warn and replace - %% the call with a call to erlang:error/1. + %% Evaluation of the function failed. Warn but keep + %% the call to ensure that extended error information + %% will be available at runtime. eval_failure(Call, Reason) end. @@ -959,15 +960,12 @@ eval_append(Call, X, Y) -> Call#c_call{args=[X,Y]}. %Rebuild call arguments. %% eval_failure(Call, Reason) -> Core. -%% Warn for a call that will fail and replace the call with -%% a call to erlang:error(Reason). +%% Warn for a call that will fail but keep the call. %% eval_failure(Call, Reason) -> Classified = classify_call(Call), add_warning(Call, {failed,{eval_failure,Classified,Reason}}), - Call#c_call{module=#c_literal{val=erlang}, - name=#c_literal{val=error}, - args=[#c_literal{val=Reason}]}. + Call. %% simplify_apply(Call0, Mod, Func, Args) -> Call %% Simplify an apply/3 to a call if the number of arguments diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl index ffdcea18a2..81d1d59680 100644 --- a/lib/compiler/src/v3_core.erl +++ b/lib/compiler/src/v3_core.erl @@ -1932,11 +1932,12 @@ map_sort_key(Key, KeyMap) -> %% pat_bin([BinElement], State) -> [BinSeg]. pat_bin(Ps0, St) -> - Ps = pat_bin_expand_strings(Ps0), + Ps = pat_bin_expand_strings(Ps0, St), pat_segments(Ps, St). -pat_bin_expand_strings(Es0) -> - foldr(fun ({bin_element,Line,{string,_,[_|_]=S},default,default}, Es1) -> +pat_bin_expand_strings(Es0, #core{dialyzer=Dialyzer}) -> + foldr(fun ({bin_element,Line,{string,_,[_|_]=S},default,default}, Es1) + when not Dialyzer -> bin_expand_string(S, Line, 0, 0, Es1); ({bin_element,Line,{string,_,S},Sz,Ts}, Es1) -> foldr( |