[latex3-commits] [git/LaTeX3-latex3-latex3] main: More precise error message for \cs_...:Nn and similar (see also #174) (eb80ba495)
Bruno Le Floch
blflatex at gmail.com
Wed May 12 13:10:19 CEST 2021
Repository : https://github.com/latex3/latex3
On branch : main
Link : https://github.com/latex3/latex3/commit/eb80ba495da23106a8887d3b7cd54eea4bd17447
>---------------------------------------------------------------
commit eb80ba495da23106a8887d3b7cd54eea4bd17447
Author: Bruno Le Floch <blflatex at gmail.com>
Date: Sun Apr 25 10:17:06 2021 +0200
More precise error message for \cs_...:Nn and similar (see also #174)
This also removes a string comparison \str_if_eq:eeTF which is slow in
LuaTeX, cf #174.
>---------------------------------------------------------------
eb80ba495da23106a8887d3b7cd54eea4bd17447
l3kernel/l3basics.dtx | 7 ++++---
l3kernel/l3msg.dtx | 1 +
l3kernel/testfiles/m3basics002.tlg | 10 ++++++----
3 files changed, 11 insertions(+), 7 deletions(-)
diff --git a/l3kernel/l3basics.dtx b/l3kernel/l3basics.dtx
index 47c746ee4..f23c8581d 100644
--- a/l3kernel/l3basics.dtx
+++ b/l3kernel/l3basics.dtx
@@ -2941,11 +2941,12 @@
{
\bool_if:NTF #3
{
- \str_if_eq:eeF { }
+ \cs_set_nopar:Npx \@@_tmp:w
{ \tl_map_function:nN {#2} \@@_generate_from_signature:n }
+ \tl_if_empty:oF \@@_tmp:w
{
- \__kernel_msg_error:nnx { kernel } { non-base-function }
- { \token_to_str:N #5 }
+ \__kernel_msg_error:nnxxx { kernel } { non-base-function }
+ { \token_to_str:N #5 } {#2} { \@@_tmp:w }
}
\cs_generate_from_arg_count:NNnn
#5 #4 { \tl_count:n {#2} } {#6}
diff --git a/l3kernel/l3msg.dtx b/l3kernel/l3msg.dtx
index ed2169b94..31690a5c3 100644
--- a/l3kernel/l3msg.dtx
+++ b/l3kernel/l3msg.dtx
@@ -1865,6 +1865,7 @@
\c_@@_coding_error_text_tl
Functions~defined~through~\iow_char:N\\cs_new:Nn~must~have~
a~signature~consisting~of~only~normal~arguments~'N'~and~'n'.~
+ The~signature~'#2'~of~'#1'~contains~other~arguments~'#3'.~
To~define~variants~use~\iow_char:N\\cs_generate_variant:Nn~
and~to~define~other~functions~use~\iow_char:N\\cs_new:Npn.
}
diff --git a/l3kernel/testfiles/m3basics002.tlg b/l3kernel/testfiles/m3basics002.tlg
index 878ed55fc..27124851a 100644
--- a/l3kernel/testfiles/m3basics002.tlg
+++ b/l3kernel/testfiles/m3basics002.tlg
@@ -111,8 +111,9 @@ For immediate help type H <return>.
l. ... }
This is a coding error.
Functions defined through \cs_new:Nn must have a signature consisting of only
-normal arguments 'N' and 'n'. To define variants use \cs_generate_variant:Nn
-and to define other functions use \cs_new:Npn.
+normal arguments 'N' and 'n'. The signature 'noc' of '\foo:noc' contains other
+arguments 'oc'. To define variants use \cs_generate_variant:Nn and to define
+other functions use \cs_new:Npn.
> \foo:noc=\long macro:#1#2#3->#1#2#3.
============================================================
============================================================
@@ -250,7 +251,8 @@ For immediate help type H <return>.
l. ... }
This is a coding error.
Functions defined through \cs_new:Nn must have a signature consisting of only
-normal arguments 'N' and 'n'. To define variants use \cs_generate_variant:Nn
-and to define other functions use \cs_new:Npn.
+normal arguments 'N' and 'n'. The signature 'abcdefghi' of '\bar:abcdefghi'
+contains other arguments 'abcdefghi'. To define variants use
+\cs_generate_variant:Nn and to define other functions use \cs_new:Npn.
Defining \bar:abcdefghi on line ...
============================================================
More information about the latex3-commits
mailing list.