The following Core Erlang module fails with the error message included below when trying to load the binary .beam file.
example.core
module 'example' ['f'/1, 'module_info'/0, 'module_info'/1] attributes [] 'f'/1 = fun (_1) -> case <_1> of <~{'foo':='foo'}~> when 'true' -> _1 end 'module_info'/0 = fun () -> call 'erlang':'get_module_info'('example') 'module_info'/1 = fun (_0) -> call 'erlang':'get_module_info'('example', _0) end
Error
$ erlc +from_core example.core $ erl -sname foo Erlang/OTP 22 [erts-10.4] [source] [64-bit] [smp:12:12] [ds:12:12:10] [async-threads:1] [hipe] Eshell V10.4 (abort with ^G) (foo@C02X74D6JGH5)1> code:load_file(example). =ERROR REPORT==== 25-May-2019::14:40:18.244091 === beam/beam_load.c(2314): Error loading function example:f/1: op i_get_map_element_hash p x a u x: no specific operation found {error,badfile} =ERROR REPORT==== 25-May-2019::14:40:18.244100 === Loading of /Users/juan.facorro/example.beam failed: badfile (foo@C02X74D6JGH5)2>
The same code compiles and loads successfully in earlier Erlang/OTP versions, so I suspect this is not an intentional change in behaviour.
Adding a second "match all" clause to the case expression makes the problem go away:
'f'/1 = fun (_1) -> case <_1> of <~{'foo':='foo'}~> when 'true' -> _1 _2 when 'true' -> 'ok' end