[erlang-patches] EEP37: Funs with names

Björn Gustavsson <>
Thu Dec 5 12:16:44 CET 2013


Could you rebase the branch on master?



On Sun, Dec 1, 2013 at 1:46 PM, Anthony Ramine <> wrote:

> Amended with your fixup and some covering code for functions named with
> "_" in xref_SUITE.
>
> Please refetch.
>
> --
> Anthony Ramine
>
> Le 28 nov. 2013 à 13:52, Anthony Ramine <> a écrit :
>
> > Hello Björn,
> >
> > Replied inline.
> >
> > --
> > Anthony Ramine
> >
> > Le 28 nov. 2013 à 13:44, Björn Gustavsson <> a
> écrit :
> >
> >> On Wed, Nov 14, 2012 at 5:42 PM, Anthony Ramine <>
> wrote:
> >> This patch implements EEP37: Funs with names
> >>
> >>
> >> It is now much closer to being graduated.
> >>
> >> I have added the branch to our daily builds for the master branch.
> >
> > Cool.
> >
> >> I would like a comment from Kostis about the Dialyzer changes.
> >
> > Me too, he suggested to me that it might break HiPE too but I couldn’t
> make HiPE crash.
> >
> >> What also remains is coverage in test suites. I have fixed a few,
> >> but xref_SUITE remains to be fixed (a named fun with the '_' name
> >> should be tested).
> >
> > Will do.
> >
> >> Here are my fixes for the test suites (also included as an attachment
> >> to make it easier to apply):
> >
> > Will apply.
> >
> >> diff --git a/lib/compiler/test/fun_SUITE.erl
> b/lib/compiler/test/fun_SUITE.erl
> >> index 0ff846e..e35692e 100644
> >> --- a/lib/compiler/test/fun_SUITE.erl
> >> +++ b/lib/compiler/test/fun_SUITE.erl
> >> @@ -197,10 +197,14 @@ external(Config) when is_list(Config) ->
> >> call_me(I) ->
> >>     {ok,I}.
> >>
> >> -id(I) ->
> >> -    I.
> >> -
> >> eep37(Config) when is_list(Config) ->
> >>     F = fun Fact(N) when N > 0 -> N * Fact(N - 1); Fact(0) -> 1 end,
> >> +    Add = fun _(N) -> N + 1 end,
> >> +    UnusedName = fun BlackAdder(N) -> N + 42 end,
> >>     720 = F(6),
> >> +    10 = Add(9),
> >> +    50 = UnusedName(8),
> >>     ok.
> >> +
> >> +id(I) ->
> >> +    I.
> >> diff --git a/lib/debugger/test/fun_SUITE.erl
> b/lib/debugger/test/fun_SUITE.erl
> >> index 569af6c..75e3b55 100644
> >> --- a/lib/debugger/test/fun_SUITE.erl
> >> +++ b/lib/debugger/test/fun_SUITE.erl
> >> @@ -288,10 +288,14 @@ external(Config) when is_list(Config) ->
> >> call_me(I) ->
> >>     {ok,I}.
> >>
> >> -id(I) ->
> >> -    I.
> >> -
> >> eep37(Config) when is_list(Config) ->
> >>     F = fun Fact(N) when N > 0 -> N * Fact(N - 1); Fact(0) -> 1 end,
> >> +    Add = fun _(N) -> N + 1 end,
> >> +    UnusedName = fun BlackAdder(N) -> N + 42 end,
> >>     720 = F(6),
> >> +    10 = Add(9),
> >> +    50 = UnusedName(8),
> >>     ok.
> >> +
> >> +id(I) ->
> >> +    I.
> >> diff --git a/lib/stdlib/test/erl_lint_SUITE.erl
> b/lib/stdlib/test/erl_lint_SUITE.erl
> >> index ea90793..ad51bfa 100644
> >> --- a/lib/stdlib/test/erl_lint_SUITE.erl
> >> +++ b/lib/stdlib/test/erl_lint_SUITE.erl
> >> @@ -644,7 +644,9 @@ unused_vars_warn_fun(Config) when is_list(Config) ->
> >>               u() ->
> >>                   fun U(U) -> foo end; % U shadowed. U unused.
> >>               u() ->
> >> -                  fun U(1) -> U; U(U) -> foo end. % U shadowed. U
> unused.
> >> +                  fun U(1) -> U; U(U) -> foo end; % U shadowed. U
> unused.
> >> +              u() ->
> >> +                  fun _(N) -> N + 1 end.  % Cover handling of '_' name.
> >>            ">>,
> >>            [warn_unused_vars],
> >>            {error,[{3,erl_lint,{unbound_var,'U'}}],
> >>
> >>
> >> id/1 is a common help function, so I want it to remain at the end
> >> of the file.
> >
> > Thanks for nitpicking even more than myself :p
> >
> >> /Bjorn
>
>


-- 
Björn Gustavsson, Erlang/OTP, Ericsson AB
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://erlang.org/pipermail/erlang-patches/attachments/20131205/0d7c78e1/attachment.html>


More information about the erlang-patches mailing list