diff --git a/lib/erlex.ex b/lib/erlex.ex index a234614..e8a9a16 100644 --- a/lib/erlex.ex +++ b/lib/erlex.ex @@ -572,7 +572,7 @@ defmodule Erlex do end end - defp atomize(<>) when is_number(atom) do + defp atomize(<>) when is_number(atom) and atom != 95 do "#{atom}" end diff --git a/test/literals_pretty_print_test.exs b/test/literals_pretty_print_test.exs index 4f5e827..503b3b2 100644 --- a/test/literals_pretty_print_test.exs +++ b/test/literals_pretty_print_test.exs @@ -131,4 +131,11 @@ defmodule Erlex.Test.LiteralsPretyPrintTest do assert pretty_printed == "<<_ :: 8, _ :: size(1)>>, false" end + + test "keep underscore in pattern" do + input = "{'embed', __@3, __@4}" + pretty_printed = Erlex.pretty_print_type(input) + + assert pretty_printed == "{:embed, _, _}" + end end