From b9a54b5275adf78a3eaa98a40bbbba34ef621acd Mon Sep 17 00:00:00 2001 From: Doug Torrance Date: Wed, 11 Sep 2024 06:32:52 -0400 Subject: [PATCH] Update processing of Usage doc key to not rely on order of "values" Previously, we assumed that "values" would return a list whose first element was a list of arguments for which isOption evaluated to true and whose second element was a list of arguments for which it evaluated to false. But the order of the elements in "values" is too dependent on the internal workings of hash tables (hash codes, buckets, linked lists, etc.), so we refactor the code to not rely on it. --- M2/Macaulay2/m2/document.m2 | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/M2/Macaulay2/m2/document.m2 b/M2/Macaulay2/m2/document.m2 index 5119f57a23..ad8486f71b 100644 --- a/M2/Macaulay2/m2/document.m2 +++ b/M2/Macaulay2/m2/document.m2 @@ -524,7 +524,8 @@ processUsage := (tag, fn, o) -> ( then error "document: Inputs or Outputs specified, but Usage not provided"; arg := if o.?Inputs then o.Inputs else {}; out := if o.?Outputs then o.Outputs else {}; - (ino, inp) := toSequence values partition(isOption, arg, {true, false}); + isopt := partition(isOption, arg, {true, false}); + (ino, inp) := (isopt#true, isopt#false); opt := getOptionDefaultValues tag.Key; inoh:= new HashTable from ino; if not isSubset(keys inoh, keys opt)