diff options
author | Björn Gustavsson <[email protected]> | 2015-11-20 14:38:18 +0100 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2015-11-20 14:38:18 +0100 |
commit | d0c318e908ab7538d5c7313a96266706ba9bafcb (patch) | |
tree | 2dba00552ac5051d6daf9d56cd84a8c87b10fc4e /lib/compiler | |
parent | e220fd51f4688d39eb8833e269c64cae24935f6e (diff) | |
parent | 53bfaec70f9f6daaae079a1c5cd852f4df214b57 (diff) | |
download | otp-d0c318e908ab7538d5c7313a96266706ba9bafcb.tar.gz otp-d0c318e908ab7538d5c7313a96266706ba9bafcb.tar.bz2 otp-d0c318e908ab7538d5c7313a96266706ba9bafcb.zip |
Merge branch 'maint'
* maint:
Fix missing filename and line number in warning
Conflicts:
lib/compiler/test/bs_match_SUITE.erl
Diffstat (limited to 'lib/compiler')
-rw-r--r-- | lib/compiler/src/sys_core_fold.erl | 6 | ||||
-rw-r--r-- | lib/compiler/test/bs_match_SUITE.erl | 25 |
2 files changed, 26 insertions, 5 deletions
diff --git a/lib/compiler/src/sys_core_fold.erl b/lib/compiler/src/sys_core_fold.erl index 0a16776bd4..43ce9a7172 100644 --- a/lib/compiler/src/sys_core_fold.erl +++ b/lib/compiler/src/sys_core_fold.erl @@ -3097,12 +3097,12 @@ bsm_ensure_no_partition_2([#c_var{name=V}|Ps], N, G, Vstate, S) -> bsm_ensure_no_partition_2([_|Ps], N, G, _, S) -> bsm_ensure_no_partition_2(Ps, N-1, G, bin_argument_order, S). -bsm_ensure_no_partition_after([#c_clause{pats=Ps}|Cs], Pos) -> +bsm_ensure_no_partition_after([#c_clause{pats=Ps}=C|Cs], Pos) -> case nth(Pos, Ps) of #c_var{} -> bsm_ensure_no_partition_after(Cs, Pos); - P -> - bsm_problem(P, bin_partition) + _ -> + bsm_problem(C, bin_partition) end; bsm_ensure_no_partition_after([], _) -> ok. diff --git a/lib/compiler/test/bs_match_SUITE.erl b/lib/compiler/test/bs_match_SUITE.erl index d8bef18a1a..667c6754ee 100644 --- a/lib/compiler/test/bs_match_SUITE.erl +++ b/lib/compiler/test/bs_match_SUITE.erl @@ -36,7 +36,8 @@ match_string/1,zero_width/1,bad_size/1,haystack/1, cover_beam_bool/1,matched_out_size/1,follow_fail_branch/1, no_partition/1,calling_a_binary/1,binary_in_map/1, - match_string_opt/1,select_on_integer/1]). + match_string_opt/1,select_on_integer/1, + map_and_binary/1]). -export([coverage_id/1,coverage_external_ignore/2]). @@ -62,7 +63,8 @@ groups() -> otp_7498,match_string,zero_width,bad_size,haystack, cover_beam_bool,matched_out_size,follow_fail_branch, no_partition,calling_a_binary,binary_in_map, - match_string_opt,select_on_integer]}]. + match_string_opt,select_on_integer, + map_and_binary]}]. init_per_suite(Config) -> @@ -1247,6 +1249,25 @@ do_select_on_integer(<<0:1,I:7>>) -> do_select_on_integer(<<1:1,_:7,Bin/binary>>) -> Bin. +%% If 'bin_opt_info' was given the warning would lack filename +%% and line number. + +map_and_binary(_Config) -> + {<<"10">>,<<"37">>,<<"am">>} = do_map_and_binary(<<"10:37am">>), + Map1 = #{time => "noon"}, + {ok,Map1} = do_map_and_binary(Map1), + Map2 = #{hour => 8, min => 42}, + {8,42,Map2} = do_map_and_binary(Map2), + ok. + +do_map_and_binary(<<Hour:2/bytes, $:, Min:2/bytes, Rest/binary>>) -> + {Hour, Min, Rest}; +do_map_and_binary(#{time := _} = T) -> + {ok, T}; +do_map_and_binary(#{hour := Hour, min := Min} = T) -> + {Hour, Min, T}. + + check(F, R) -> R = F(). |