Re: no function clause matching became no case clause matching exception

Roger Lipscombe <[email protected]>
Newsgroups gmane.comp.lang.erlang.general
Message-ID <CAJgnQd_s1k4OrpADOvcoEhZ7yc6uip=okvaHg7p-rsbYp0Mahg@mail.gmail.com>
Confirmed. With compilation, the behaviour changed somewhere between 23.0.3:

$ erl
Erlang/OTP 23 [erts-11.0.3] [source] [64-bit] [smp:12:12]
[ds:12:12:10] [async-threads:1]

Eshell V11.0.3  (abort with ^G)
1> c(t).
t.erl:2: Warning: export_all flag enabled - all functions will be exported
{ok,t}
2> t:t().
** exception error: no function clause matching t:'-t/0-fun-1-'(b)
(t.erl, line 4)
     in function  t:'-t/0-lc$^0/1-0-'/1 (t.erl, line 4)
     in call from t:'-t/0-lc$^0/1-0-'/1 (t.erl, line 4)

...and 24.1.7:

$ source ~/.kerl/erlangs/OTP-24.1.7/activate
$ erl
Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:12:12]
[ds:12:12:10] [async-threads:1] [jit]

Eshell V12.1.5  (abort with ^G)
1> c(t).
t.erl:2:2: Warning: export_all flag enabled - all functions will be exported
%    2| -compile(export_all).
%     |  ^

{ok,t}
2> t:t().
** exception error: no case clause matching {b}
     in function  t:'-t/0-lc$^0/1-0-'/1 (t.erl, line 4)
     in call from t:'-t/0-lc$^0/1-0-'/1 (t.erl, line 4)


On Fri, 10 Dec 2021 at 15:16, Frans Schneider <[email protected]> wrote:
>
>
> Op 10-12-2021 om 15:58 schreef Roger Lipscombe:
> > On Fri, 10 Dec 2021 at 14:52, Frans Schneider <[email protected]> wrote:
> >> The following list comprehension used to give a no function clause
> >> matching exception in previous version of Erlang. Now it will emit a no
> >> case clause matching exception. Is this expected behavior?
> > Which versions? I've tested on OTP-24.1.7, and it gives me a function
> > clause error:
> >
> > Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:12:12]
> > [ds:12:12:10] [async-threads:1] [jit]
> >
> > Eshell V12.1.5  (abort with ^G)
> > 1> [(fun(a) -> "a" end)(R) || R <- [a, b, c]].
> > ** exception error: no function clause matching
> > erl_eval:'-inside-an-interpreted-fun-'(b)
>
> Same version here:
>
> Erlang/OTP 24 [erts-12.1.5] [source] [64-bit] [smp:2:2] [ds:2:2:10]
> [async-threads:1] [jit]
>
> Eshell V12.1.5  (abort with ^G)
>
> In the REPL it does give the expected exception indeed, but when I
> compile, it gives the no case clause exception:
>
> -module(t).
> -compile(export_all).
> t() ->
>      [(fun(a) -> "a" end)(R) || R <- [a, b, c]].
>
> 5> t:t().
> ** exception error: no case clause matching {b}
>       in function  t:'-t/0-lc$^0/1-0-'/1 (/home/frans/pm/src/t.erl, line 4)
>       in call from t:'-t/0-lc$^0/1-0-'/1 (/home/frans/pm/src/t.erl, line 4)
>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.