diff options
author | Björn-Egil Dahlberg <[email protected]> | 2014-03-19 16:49:20 +0100 |
---|---|---|
committer | Björn-Egil Dahlberg <[email protected]> | 2014-03-19 16:49:20 +0100 |
commit | 41fe9a38393fde81298e722abdb1013ac8224c17 (patch) | |
tree | 1d23f417fc1798e7c67528e0ed12c371c08049d3 /lib | |
parent | 57a9bc4c710690d1c7b219a9cd53b8cecbe6851e (diff) | |
parent | ca39d2c98507963f461adb78975e5adf35d6aafe (diff) | |
download | otp-41fe9a38393fde81298e722abdb1013ac8224c17.tar.gz otp-41fe9a38393fde81298e722abdb1013ac8224c17.tar.bz2 otp-41fe9a38393fde81298e722abdb1013ac8224c17.zip |
Merge branch 'nox/maps-v3_core-lit_vars'
* nox/maps-v3_core-lit_vars:
Properly collect variables in map expressions in v3_core
Diffstat (limited to 'lib')
-rw-r--r-- | lib/compiler/src/v3_core.erl | 2 | ||||
-rw-r--r-- | lib/compiler/test/map_SUITE.erl | 12 |
2 files changed, 12 insertions, 2 deletions
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl index 082809b8a0..04210ae243 100644 --- a/lib/compiler/src/v3_core.erl +++ b/lib/compiler/src/v3_core.erl @@ -2206,6 +2206,8 @@ lit_vars(Lit) -> lit_vars(Lit, []). lit_vars(#c_cons{hd=H,tl=T}, Vs) -> lit_vars(H, lit_vars(T, Vs)); lit_vars(#c_tuple{es=Es}, Vs) -> lit_list_vars(Es, Vs); +lit_vars(#c_map{arg=V,es=Es}, Vs) -> lit_vars(V, lit_list_vars(Es, Vs)); +lit_vars(#c_map_pair{key=K,val=V}, Vs) -> lit_vars(K, lit_vars(V, Vs)); lit_vars(#c_var{name=V}, Vs) -> add_element(V, Vs); lit_vars(_, Vs) -> Vs. %These are atomic diff --git a/lib/compiler/test/map_SUITE.erl b/lib/compiler/test/map_SUITE.erl index b7e27afef1..90eae6fb4f 100644 --- a/lib/compiler/test/map_SUITE.erl +++ b/lib/compiler/test/map_SUITE.erl @@ -43,7 +43,8 @@ %% errors in 17.0-rc1 t_update_values/1, - t_expand_map_update/1 + t_expand_map_update/1, + t_export/1 ]). suite() -> []. @@ -70,7 +71,8 @@ all() -> [ %% errors in 17.0-rc1 t_update_values, - t_expand_map_update + t_expand_map_update, + t_export ]. groups() -> []. @@ -285,6 +287,12 @@ t_expand_map_update(Config) when is_list(Config) -> #{<<"hello">> := <<"les gens">>} = M, ok. +t_export(Config) when is_list(Config) -> + Raclette = id(#{}), + case brie of brie -> Fromage = Raclette end, + Raclette = Fromage#{}, + ok. + check_val(#{val1:=V1, val2:=V2},V1,V2) -> ok. get_val(#{ "wazzup" := _, val := V}) -> V; |