Skip to content

Commit dad832d

Browse files
committed
Fix quoting of bitstring literals
1 parent 094b64c commit dad832d

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

lib/elixir/src/elixir_quote.erl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -238,7 +238,7 @@ do_quote(BitString, #elixir_quote{escape=true} = Q, _) when is_bitstring(BitStri
238238
{BitString, Q};
239239
Size ->
240240
<<Bits:Size, Bytes/binary>> = BitString,
241-
{{'<<>>', [], [{'::', [], [Bits, Size]}, Bytes]}, Q}
241+
{{'<<>>', [], [{'::', [], [Bits, {size, [], [Size]}]}, {'::', [], [Bytes, {binary, [], []}]}]}, Q}
242242
end;
243243

244244
do_quote(Map, #elixir_quote{escape=true} = Q, E) when is_map(Map) ->

lib/elixir/test/elixir/macro_test.exs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ defmodule MacroTest do
4343
end
4444

4545
test "escape handles bitstring" do
46-
assert {:<<>>, [], [{:::, [], [1, 4]}, ","]} == Macro.escape(<<300::12>>)
46+
assert {:<<>>, [], [{:::, [], [1, {:size, [], [4]}]}, {:::, [], [",", {:binary, [], []}]}]} == Macro.escape(<<300::12>>)
4747
end
4848

4949
test "escape works recursively" do

0 commit comments

Comments
 (0)