Skip to content

Fix issue with contextFraction when checking for repeated formulas (#567)#569

Merged
drdrew42 merged 2 commits intoopenwebwork:developfrom
dpvc:issue567
May 5, 2021
Merged

Fix issue with contextFraction when checking for repeated formulas (#567)#569
drdrew42 merged 2 commits intoopenwebwork:developfrom
dpvc:issue567

Conversation

@dpvc
Copy link
Member

@dpvc dpvc commented Apr 25, 2021

This PR fixes several problems that cause the issue described in #567 with the Fraction context. The main problem was that the string() and TeX() methods were handling the parameters incorrectly (there are two that were missing, and $prec was getting the value from the first of them, which is what was causing the error). The same issue also occurs for the Real class (which is probably why it made it into the Fraction class).

There is also a potential issue in the function-equivalence checking post-filter, which is that the context flags used there are not necessarily the same as the ones used in the main cmp() method. So I've added the calls that set/reset the flags, which are duplicated from the main function.

Finally, I adjust the Union string() and TeX() to handle undefined $prec in the same way as in other MathObject classes (the current fix seems to assume that 0 is the lowest precedence, but there is no guarantee of that).


sub string {
my $self = shift; my $equation = shift; my $prec = shift;
my $self = shift; my $equation = shift; shift; shift; my $prec = shift;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The extra shifts seem to be for "open" and "close" which some such routines need.

Copy link
Member

@pstaabp pstaabp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks good.

@drdrew42 drdrew42 merged commit 0cc9e2e into openwebwork:develop May 5, 2021
drgrice1 pushed a commit that referenced this pull request May 5, 2021
Fix issue with contextFraction when checking for repeated formulas (#567)
@dpvc dpvc deleted the issue567 branch January 3, 2023 07:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants