diff options
author | John Högberg <john@erlang.org> | 2023-04-27 08:57:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-04-27 08:57:23 +0200 |
commit | 734f78d5b0a998d65ac5fc3710ebef84e3338729 (patch) | |
tree | 55bcd7cbed01d1897a5e4e27b85b9ca74d69ddd1 | |
parent | a78b8e0769bba69ba1245cce850b226bdf6940fa (diff) | |
parent | fd2d11a657cda8e91ff8b7443041879cd9694e43 (diff) | |
download | erlang-734f78d5b0a998d65ac5fc3710ebef84e3338729.tar.gz |
Merge pull request #7161 from jhogberg/john/dialyzer/fix-bin-construction-warning-unicode-crash/OTP-18564
dialyzer: Fix crash on formatting warning containing unicode text
-rw-r--r-- | lib/dialyzer/src/dialyzer.erl | 4 | ||||
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/results/gh_7153 | 3 | ||||
-rw-r--r-- | lib/dialyzer/test/small_SUITE_data/src/gh_7153.erl | 5 |
3 files changed, 10 insertions, 2 deletions
diff --git a/lib/dialyzer/src/dialyzer.erl b/lib/dialyzer/src/dialyzer.erl index a502f7107d..ecfc509e34 100644 --- a/lib/dialyzer/src/dialyzer.erl +++ b/lib/dialyzer/src/dialyzer.erl @@ -415,8 +415,8 @@ message_to_string({app_call, [M, F, Args, Culprit, ExpectedType, FoundType]}, [M, F, a(Args, I), c(Culprit, I), t(ExpectedType, I), t(FoundType, I)]); message_to_string({bin_construction, [Culprit, Size, Seg, Type]}, I, _E) -> - io_lib:format("Binary construction will fail since the ~s field ~s in" - " segment ~s has type ~s\n", + io_lib:format("Binary construction will fail since the ~ts field ~ts in" + " segment ~ts has type ~ts\n", [Culprit, c(Size, I), c(Seg, I), t(Type, I)]); message_to_string({call, [M, F, Args, ArgNs, FailReason, SigArgs, SigRet, Contract]}, I, _E) -> diff --git a/lib/dialyzer/test/small_SUITE_data/results/gh_7153 b/lib/dialyzer/test/small_SUITE_data/results/gh_7153 new file mode 100644 index 0000000000..c596a89f82 --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/results/gh_7153 @@ -0,0 +1,3 @@ + +gh_7153.erl:4:1: Function t/1 has no local return +gh_7153.erl:5:7: Binary construction will fail since the value field X in segment X/utf8 has type '原子' diff --git a/lib/dialyzer/test/small_SUITE_data/src/gh_7153.erl b/lib/dialyzer/test/small_SUITE_data/src/gh_7153.erl new file mode 100644 index 0000000000..ef2ef3a25b --- /dev/null +++ b/lib/dialyzer/test/small_SUITE_data/src/gh_7153.erl @@ -0,0 +1,5 @@ +-module(gh_7153). +-export([t/1]). + +t(X = '原子') -> + <<X/utf8>>. |