File 0199-epp-Correct-stringification-of-non-latin1-atoms.patch of Package erlang
From d927158ae3379d8d299e49208af3c17a9d7cb0d0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Bj=C3=B6rn=20Gustavsson?= <bjorn@erlang.org>
Date: Thu, 9 Jan 2025 09:50:19 +0100
Subject: [PATCH] epp: Correct stringification of non-latin1 atoms
Closes #9173
---
lib/stdlib/src/epp.erl | 2 ++
lib/stdlib/test/epp_SUITE.erl | 19 +++++++++++++++++--
2 files changed, 19 insertions(+), 2 deletions(-)
diff --git a/lib/stdlib/src/epp.erl b/lib/stdlib/src/epp.erl
index bde54ea751..a59f847548 100644
--- a/lib/stdlib/src/epp.erl
+++ b/lib/stdlib/src/epp.erl
@@ -2172,6 +2172,8 @@ token_src({char,_,C}) ->
io_lib:write_char(C);
token_src({string, _, X}) ->
io_lib:write_string(X);
+token_src({atom, _, X}) ->
+ io_lib:write_atom(X);
token_src({_, _, X}) ->
io_lib:format("~w", [X]).
diff --git a/lib/stdlib/test/epp_SUITE.erl b/lib/stdlib/test/epp_SUITE.erl
index 84d0d89940..b3505254a2 100644
--- a/lib/stdlib/test/epp_SUITE.erl
+++ b/lib/stdlib/test/epp_SUITE.erl
@@ -32,7 +32,8 @@
test_if/1,source_name/1,otp_16978/1,otp_16824/1,scan_file/1,file_macro/1,
deterministic_include/1, nondeterministic_include/1,
gh_8268/1,
- moduledoc_include/1
+ moduledoc_include/1,
+ stringify/1
]).
-export([epp_parse_erl_form/2]).
@@ -78,7 +79,8 @@ all() ->
otp_14285, test_if, source_name, otp_16978, otp_16824, scan_file, file_macro,
deterministic_include, nondeterministic_include,
gh_8268,
- moduledoc_include].
+ moduledoc_include,
+ stringify].
groups() ->
[{upcase_mac, [], [upcase_mac_1, upcase_mac_2]},
@@ -2121,6 +2123,19 @@ gh_8268(Config) ->
[] = run(Config, Ts),
ok.
+stringify(Config) ->
+ Ts = [{stringify_1,
+ ~"""
+ -define(S(S), ??S).
+ t() ->
+ ~S('атом') = ?S('атом'),
+ ~S("атом") = ?S("атом"),
+ ok.
+ """,
+ [],
+ ok}],
+ [] = run(Config, Ts),
+ ok.
%% Start location is 1.
check(Config, Tests) ->
--
2.43.0