Fix issue with contextFraction when checking for repeated formulas (#567)#569
Merged
drdrew42 merged 2 commits intoopenwebwork:developfrom May 5, 2021
Merged
Fix issue with contextFraction when checking for repeated formulas (#567)#569drdrew42 merged 2 commits intoopenwebwork:developfrom
drdrew42 merged 2 commits intoopenwebwork:developfrom
Conversation
taniwallach
reviewed
May 5, 2021
|
|
||
| sub string { | ||
| my $self = shift; my $equation = shift; my $prec = shift; | ||
| my $self = shift; my $equation = shift; shift; shift; my $prec = shift; |
Member
There was a problem hiding this comment.
The extra shifts seem to be for "open" and "close" which some such routines need.
drdrew42
approved these changes
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)
This was referenced Oct 13, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This PR fixes several problems that cause the issue described in #567 with the Fraction context. The main problem was that the
string()andTeX()methods were handling the parameters incorrectly (there are two that were missing, and$precwas 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()andTeX()to handle undefined$precin 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).