[latex3-commits] [latex3/latex3] main: Correct error recovery for l3fp abs applied to a tuple (fixes #1238) (e653853b8)
github at latex-project.org
github at latex-project.org
Sat Jun 24 17:48:03 CEST 2023
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/e653853b84fe1e3c11f7ed52656c8aee67f1e99e
>---------------------------------------------------------------
commit e653853b84fe1e3c11f7ed52656c8aee67f1e99e
Author: Bruno Le Floch <blflatex at gmail.com>
Date: Sat Jun 24 17:48:03 2023 +0200
Correct error recovery for l3fp abs applied to a tuple (fixes #1238)
>---------------------------------------------------------------
e653853b84fe1e3c11f7ed52656c8aee67f1e99e
l3kernel/CHANGELOG.md | 1 +
l3kernel/l3fp-basics.dtx | 7 ++++---
l3kernel/testfiles/m3fp-basics004.lvt | 1 +
l3kernel/testfiles/m3fp-basics004.tlg | 9 +++++++++
4 files changed, 15 insertions(+), 3 deletions(-)
diff --git a/l3kernel/CHANGELOG.md b/l3kernel/CHANGELOG.md
index d5432ff77..4596a5f30 100644
--- a/l3kernel/CHANGELOG.md
+++ b/l3kernel/CHANGELOG.md
@@ -17,6 +17,7 @@ this project uses date-based 'snapshot' version identifiers.
### Fixed
- Case changing of Greek characters with complex NFD representation (issue \#1236)
+- Error recovery when wrongly applying abs to a tuple (issue \#1238)
## [2023-06-16]
diff --git a/l3kernel/l3fp-basics.dtx b/l3kernel/l3fp-basics.dtx
index dc6a92e10..0725fa887 100644
--- a/l3kernel/l3fp-basics.dtx
+++ b/l3kernel/l3fp-basics.dtx
@@ -2108,15 +2108,16 @@
% map over all items in the tuple an auxiliary that dispatches to the
% type-appropriate sign-flipping function.
% \begin{macrocode}
-\cs_new:Npn \@@_tuple_set_sign_o:w #1
+\cs_new:Npn \@@_tuple_set_sign_o:w #1#2 @
{
\if_meaning:w 2 #1
\exp_after:wN \@@_tuple_set_sign_aux_o:Nnw
\fi:
\@@_invalid_operation_o:nw { abs }
+ #2
}
-\cs_new:Npn \@@_tuple_set_sign_aux_o:Nnw #1#2#3 @
- { \@@_tuple_map_o:nw \@@_tuple_set_sign_aux_o:w #3 }
+\cs_new:Npn \@@_tuple_set_sign_aux_o:Nnw #1#2
+ { \@@_tuple_map_o:nw \@@_tuple_set_sign_aux_o:w }
\cs_new:Npn \@@_tuple_set_sign_aux_o:w #1#2 ;
{
\@@_change_func_type:NNN #1 \@@_set_sign_o:w
diff --git a/l3kernel/testfiles/m3fp-basics004.lvt b/l3kernel/testfiles/m3fp-basics004.lvt
index 95832ac02..8df2413e4 100644
--- a/l3kernel/testfiles/m3fp-basics004.lvt
+++ b/l3kernel/testfiles/m3fp-basics004.lvt
@@ -31,6 +31,7 @@
\fp_set:Nn \l_tmpa_fp { nan }
\fp_set:Nn \l_tmpb_fp { abs(nan) }
\cs_if_eq:NNF \l_tmpa_fp \l_tmpb_fp { \ERROR }
+ \TYPE { \fp_to_tl:n { abs((1,2)) } } % expected error
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
diff --git a/l3kernel/testfiles/m3fp-basics004.tlg b/l3kernel/testfiles/m3fp-basics004.tlg
index 2150bc72d..f22a5978e 100644
--- a/l3kernel/testfiles/m3fp-basics004.tlg
+++ b/l3kernel/testfiles/m3fp-basics004.tlg
@@ -15,6 +15,15 @@ TEST 1: abs()
inf
inf
nan
+! Use of \??? doesn't match its definition.
+<argument> \???
+ ! LaTeX Error: Invalid operation abs((1, 2))
+l. ... }
+If you say, e.g., `\def\a1{...}', then you must always
+put `1' after `\a', since control sequence names are
+made up of letters only. The macro here has not been
+followed by the required stuff, so I'm ignoring it.
+nan
============================================================
============================================================
TEST 2: +()
More information about the latex3-commits
mailing list.