diff options
author | Björn Gustavsson <[email protected]> | 2018-04-19 14:07:42 +0200 |
---|---|---|
committer | Björn Gustavsson <[email protected]> | 2018-04-19 14:07:42 +0200 |
commit | 0e831fff602e9c13471d4833a0e78c94020a86b6 (patch) | |
tree | 93cd824883e57a416e3d02e78b07ceaf48ca3f74 /lib/compiler/test/compile_SUITE.erl | |
parent | 060d1982d93b83c142e594a88433c4cf80032533 (diff) | |
parent | 6626b2a4ac67631bef3144bf9eca41b5f49c3176 (diff) | |
download | otp-0e831fff602e9c13471d4833a0e78c94020a86b6.tar.gz otp-0e831fff602e9c13471d4833a0e78c94020a86b6.tar.bz2 otp-0e831fff602e9c13471d4833a0e78c94020a86b6.zip |
Merge branch 'bjorn/compiler/core_lint'
* bjorn/compiler/core_lint:
core_lint: Handle repeated variables in map patterns correctly
Diffstat (limited to 'lib/compiler/test/compile_SUITE.erl')
-rw-r--r-- | lib/compiler/test/compile_SUITE.erl | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/lib/compiler/test/compile_SUITE.erl b/lib/compiler/test/compile_SUITE.erl index eee5bc733f..a1de8961bd 100644 --- a/lib/compiler/test/compile_SUITE.erl +++ b/lib/compiler/test/compile_SUITE.erl @@ -1111,10 +1111,30 @@ remove_compiler_gen(M) -> remove_compiler_gen_1(Pair) -> Op0 = cerl:map_pair_op(Pair), Op = cerl:set_ann(Op0, []), - K = cerl:map_pair_key(Pair), - V = cerl:map_pair_val(Pair), + K = map_var(cerl:map_pair_key(Pair)), + V = map_var(cerl:map_pair_val(Pair)), cerl:update_c_map_pair(Pair, Op, K, V). +map_var(Var) -> + case cerl:is_c_var(Var) of + true -> + case cerl:var_name(Var) of + Name when is_atom(Name) -> + L = atom_to_list(Name), + try list_to_integer(L) of + Int -> + cerl:update_c_var(Var, Int) + catch + error:_ -> + Var + end; + _ -> + Var + end; + false -> + Var + end. + %% Compile to Beam assembly language (.S) and then try to %% run .S through the compiler again. |