[latex3-commits] [latex3/latex3] flag-N-type: Correct \flag_clear:N error checking when debugging (e88b9bfba)

github at latex-project.org github at latex-project.org
Fri Jan 12 18:57:44 CET 2024


Repository : https://github.com/latex3/latex3
On branch  : flag-N-type
Link       : https://github.com/latex3/latex3/commit/e88b9bfbadd1e5a7a5025f42d70f5af1d9c7a911

>---------------------------------------------------------------

commit e88b9bfbadd1e5a7a5025f42d70f5af1d9c7a911
Author: Bruno Le Floch <blflatex at gmail.com>
Date:   Fri Jan 12 18:57:44 2024 +0100

    Correct \flag_clear:N error checking when debugging
    
    I opted to only raise an expandable (rather than a more verbose
    protected) error when the argument is undefined, because this allows
    using the same auxiliary as for \flag_height:N and other expandable
    flag commands.  This auxiliary is needed to clean up a bit and avoid
    having infinitely many errors in a loop.


>---------------------------------------------------------------

e88b9bfbadd1e5a7a5025f42d70f5af1d9c7a911
 l3kernel/l3debug.dtx             |  8 +++++++-
 l3kernel/testfiles/m3flag001.tlg | 10 ----------
 l3kernel/testfiles/m3flag002.tlg | 10 ----------
 3 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/l3kernel/l3debug.dtx b/l3kernel/l3debug.dtx
index 194db616a..0fcdf6b19 100644
--- a/l3kernel/l3debug.dtx
+++ b/l3kernel/l3debug.dtx
@@ -964,7 +964,6 @@
     { \__kernel_chk_flag_exist:NN }
     { }
     {
-      \flag_clear:N
       \flag_ensure_raised:N
       \flag_height:N
       \flag_if_raised:NT
@@ -989,6 +988,13 @@
     { \__kernel_chk_var_scope:NN l #1 }
     { }
     { \flag_new:N }
+  \__kernel_patch:nnn
+    {
+      \__kernel_chk_var_scope:NN l #1
+      \__kernel_chk_flag_exist:NN
+    }
+    { }
+    { \flag_clear:N }
   \__kernel_patch:nnn
     { \__kernel_chk_var_scope:NN g #1 }
     { }
diff --git a/l3kernel/testfiles/m3flag001.tlg b/l3kernel/testfiles/m3flag001.tlg
index 9f9cfbf62..d8bbe2e73 100644
--- a/l3kernel/testfiles/m3flag001.tlg
+++ b/l3kernel/testfiles/m3flag001.tlg
@@ -54,16 +54,6 @@ defined yet.
 ============================================================
 TEST 5: undefined
 ============================================================
-! LaTeX Error: The variable \l_other_flag has not been declared on line ...
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-Checking is active, and you have tried do so something like:
-  \tl_set:Nn \l_other_flag { ... }
-without first having:
-  \tl_new:N \l_other_flag
-LaTeX will create the variable and continue.
 ! Use of \??? doesn't match its definition.
 <argument> \???  
                  ! LaTeX Error: Erroneous variable \l_other_flag used!
diff --git a/l3kernel/testfiles/m3flag002.tlg b/l3kernel/testfiles/m3flag002.tlg
index fe368e782..66878e326 100644
--- a/l3kernel/testfiles/m3flag002.tlg
+++ b/l3kernel/testfiles/m3flag002.tlg
@@ -54,16 +54,6 @@ defined yet.
 ============================================================
 TEST 5: undefined
 ============================================================
-! LaTeX Error: The variable \l_other_flag has not been declared on line ...
-For immediate help type H <return>.
- ...                                              
-l. ...  }
-This is a coding error.
-Checking is active, and you have tried do so something like:
-  \tl_set:Nn \l_other_flag { ... }
-without first having:
-  \tl_new:N \l_other_flag
-LaTeX will create the variable and continue.
 ! Use of \??? doesn't match its definition.
 <argument> \???  
                  ! LaTeX Error: Erroneous variable \l_other_flag used!





More information about the latex3-commits mailing list.