Skip to content

Commit

Permalink
Fix for OTP25
Browse files Browse the repository at this point in the history
  • Loading branch information
elbrujohalcon committed Oct 25, 2024
1 parent 2954616 commit 12dded7
Showing 1 changed file with 16 additions and 6 deletions.
22 changes: 16 additions & 6 deletions test_app/src/otp26.erl
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,21 @@
-export([map_comprehensions/3]).

map_comprehensions(Map, List, Binary) ->
MapFromList = #{ {k, Key} => {value, Value} || Key <- List, Value <- List },
MapFromBinary = #{ {k, Key} => {value, Value} || <<Key/float>> <- Binary, Key >= 8.24551123345, <<Value/binary>> <- Binary},
MapFromMap = #{ #{key => Key} => [value, Value, is_a_value] || {k, Key} := {value, Value} <- MapFromList, is_integer(Key) },
MapFromCombo = #{ Key => binary_to_atom(Value) || Key <- List, <<Value/binary>> <= Binary},
ListFromMap = [{Key, Value} || {k, Key} := Value <- MapFromBinary, with:one_filter(Key), with:another_filter(Value) == <<"a good value">>],
BinaryFromMap = << <<Key:64, $|, Value/binary>> || #{key := Key} := [value, Value | _] <- MapFromMap, is_binary(Value) >>,
MapFromList = #{{k, Key} => {value, Value} || Key <- List, Value <- List},
MapFromBinary =
#{{k, Key} => {value, Value}
|| <<Key/float>> <- Binary, Key >= 8.24551123345, <<Value/binary>> <- Binary},
MapFromMap =
#{#{key => Key} => [value, Value, is_a_value]
|| {k, Key} := {value, Value} <- MapFromList, is_integer(Key)},
MapFromCombo = #{Key => binary_to_atom(Value) || Key <- List, <<Value/binary>> <= Binary},
ListFromMap =
[{Key, Value}
|| {k, Key} := Value <- MapFromBinary,
with:one_filter(Key),
with:another_filter(Value) == <<"a good value">>],
BinaryFromMap =
<< <<Key:64, $|, Value/binary>>
|| #{key := Key} := [value, Value | _] <- MapFromMap, is_binary(Value) >>,
NoGenerator = #{k => v || this:is_true()},
#{MapFromCombo => ListFromMap, BinaryFromMap => NoGenerator}.

0 comments on commit 12dded7

Please sign in to comment.