Skip to content

Commit

Permalink
Update processing of Usage doc key to not rely on order of "values"
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
d-torrance committed Sep 11, 2024
1 parent a061261 commit b9a54b5
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion M2/Macaulay2/m2/document.m2
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit b9a54b5

Please sign in to comment.