no function clause matching became no case clause matching exception

Roger Lipscombe roger@REDACTED
Fri Dec 10 16:30:53 CET 2021


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 <fchschneider@REDACTED> wrote:
>
>
> Op 10-12-2021 om 15:58 schreef Roger Lipscombe:
> > On Fri, 10 Dec 2021 at 14:52, Frans Schneider <fchschneider@REDACTED> 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)
>


More information about the erlang-questions mailing list