diff options
| author | Björn Gustavsson <[email protected]> | 2015-02-03 07:51:34 +0100 | 
|---|---|---|
| committer | Björn Gustavsson <[email protected]> | 2015-02-03 07:51:34 +0100 | 
| commit | f2d3f06b0f77ea1382b6aa39fb6c73ad1d586d6a (patch) | |
| tree | 824fc247e6049575a2a0324a1a985d2432d57bde /lib/compiler/test | |
| parent | edf6a220668d7461044918c10190b41ea7a4891d (diff) | |
| parent | 94b36c7c2534f92e1d1ce768fb63d9012bb0c630 (diff) | |
| download | otp-f2d3f06b0f77ea1382b6aa39fb6c73ad1d586d6a.tar.gz otp-f2d3f06b0f77ea1382b6aa39fb6c73ad1d586d6a.tar.bz2 otp-f2d3f06b0f77ea1382b6aa39fb6c73ad1d586d6a.zip | |
Merge branch 'bjorn/compiler/map-bugs/OTP-12451' into maint
* bjorn/compiler/map-bugs/OTP-12451:
  Be more careful about map patterns when evalutating element/2
  Do not convert map patterns to map expressions
Diffstat (limited to 'lib/compiler/test')
| -rw-r--r-- | lib/compiler/test/core_fold_SUITE.erl | 6 | ||||
| -rw-r--r-- | lib/compiler/test/match_SUITE.erl | 7 | 
2 files changed, 13 insertions, 0 deletions
| diff --git a/lib/compiler/test/core_fold_SUITE.erl b/lib/compiler/test/core_fold_SUITE.erl index 6a7036d728..9c7e97a1bf 100644 --- a/lib/compiler/test/core_fold_SUITE.erl +++ b/lib/compiler/test/core_fold_SUITE.erl @@ -60,6 +60,12 @@ t_element(Config) when is_list(Config) ->      X = make_ref(),      ?line X = id(element(1, {X,y,z})),      ?line b = id(element(2, {a,b,c,d})), +    (fun() -> +	    case {a,#{k=>X}} of +		{a,#{k:=X}}=Tuple -> +		    #{k:=X} = id(element(2, Tuple)) +	    end +    end)(),      %% No optimization, but should work.      Tuple = id({x,y,z}), diff --git a/lib/compiler/test/match_SUITE.erl b/lib/compiler/test/match_SUITE.erl index e5aaf49d6f..1e778dca24 100644 --- a/lib/compiler/test/match_SUITE.erl +++ b/lib/compiler/test/match_SUITE.erl @@ -406,12 +406,19 @@ underscore(Config) when is_list(Config) ->  match_map(Config) when is_list(Config) ->      Map = #{key=>{x,y},ignore=>anything},      #s{map=Map,t={x,y}} = do_match_map(#s{map=Map}), +    {a,#{k:={a,b,c}}} = do_match_map_2(#{k=>{a,b,c}}),      ok.  do_match_map(#s{map=#{key:=Val}}=S) ->      %% Would crash with a 'badarg' exception.      S#s{t=Val}. +do_match_map_2(Map) -> +    case {a,Map} of +	{a,#{k:=_}}=Tuple -> +	    Tuple +    end. +  coverage(Config) when is_list(Config) ->      %% Cover beam_dead.      ok = coverage_1(x, a), | 
