no function clause matching became no case clause matching exception

Frans Schneider fchschneider@REDACTED
Fri Dec 10 16:16:11 CET 2021


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