aboutsummaryrefslogtreecommitdiffstats
path: root/lib/compiler
diff options
context:
space:
mode:
authorBjörn Gustavsson <[email protected]>2014-11-17 16:18:24 +0100
committerBjörn Gustavsson <[email protected]>2014-11-17 16:18:24 +0100
commitc85746b2fa2780435051611caa87639c770a4d91 (patch)
tree3c6f91940e275a51adbf7b970b4c30001bae9e67 /lib/compiler
parent2045ebf21c428711c55edddbc93ec8d024d47020 (diff)
parent761e1318abdaee269be8cdcbb6b3e6f5d3f2a65d (diff)
downloadotp-c85746b2fa2780435051611caa87639c770a4d91.tar.gz
otp-c85746b2fa2780435051611caa87639c770a4d91.tar.bz2
otp-c85746b2fa2780435051611caa87639c770a4d91.zip
Merge branch 'maint'
* maint: Fix miscompilation when module contains multiple named funs Fix locations of shadowing warnings in ms_transform
Diffstat (limited to 'lib/compiler')
-rw-r--r--lib/compiler/src/v3_core.erl4
-rw-r--r--lib/compiler/test/fun_SUITE.erl19
2 files changed, 17 insertions, 6 deletions
diff --git a/lib/compiler/src/v3_core.erl b/lib/compiler/src/v3_core.erl
index 6b9450e481..612660c2d6 100644
--- a/lib/compiler/src/v3_core.erl
+++ b/lib/compiler/src/v3_core.erl
@@ -653,8 +653,8 @@ expr({'fun',L,{clauses,Cs},Id}, St) ->
fun_tq(Id, Cs, L, St, unnamed);
expr({named_fun,L,'_',Cs,Id}, St) ->
fun_tq(Id, Cs, L, St, unnamed);
-expr({named_fun,L,Name,Cs,{Index,Uniq,_Fname}}, St) ->
- fun_tq({Index,Uniq,Name}, Cs, L, St, {named, Name});
+expr({named_fun,L,Name,Cs,Id}, St) ->
+ fun_tq(Id, Cs, L, St, {named,Name});
expr({call,L,{remote,_,M,F},As0}, #core{wanted=Wanted}=St0) ->
{[M1,F1|As1],Aps,St1} = safe_list([M,F|As0], St0),
Lanno = lineno_anno(L, St1),
diff --git a/lib/compiler/test/fun_SUITE.erl b/lib/compiler/test/fun_SUITE.erl
index 25b7f677b5..a3e9b7fe4e 100644
--- a/lib/compiler/test/fun_SUITE.erl
+++ b/lib/compiler/test/fun_SUITE.erl
@@ -21,10 +21,10 @@
-export([all/0, suite/0,groups/0,init_per_suite/1, end_per_suite/1,
init_per_group/2,end_per_group/2,
test1/1,overwritten_fun/1,otp_7202/1,bif_fun/1,
- external/1,eep37/1,badarity/1]).
+ external/1,eep37/1,eep37_dup/1,badarity/1]).
-%% Internal export.
--export([call_me/1]).
+%% Internal exports.
+-export([call_me/1,dup1/0,dup2/0]).
-include_lib("test_server/include/test_server.hrl").
@@ -32,7 +32,7 @@ suite() -> [{ct_hooks,[ts_install_cth]}].
all() ->
test_lib:recompile(?MODULE),
- [test1,overwritten_fun,otp_7202,bif_fun,external,eep37,badarity].
+ [test1,overwritten_fun,otp_7202,bif_fun,external,eep37,eep37_dup,badarity].
groups() ->
[].
@@ -206,6 +206,17 @@ eep37(Config) when is_list(Config) ->
50 = UnusedName(8),
ok.
+eep37_dup(Config) when is_list(Config) ->
+ dup1 = (dup1())(),
+ dup2 = (dup2())(),
+ ok.
+
+dup1() ->
+ fun _F() -> dup1 end.
+
+dup2() ->
+ fun _F() -> dup2 end.
+
badarity(Config) when is_list(Config) ->
{'EXIT',{{badarity,{_,[]}},_}} = (catch (fun badarity/1)()),
ok.