From 5b90c7fd22dcd8096f2542defd8ab0c8a89aa6a2 Mon Sep 17 00:00:00 2001 From: Glenn Rice Date: Fri, 28 Jan 2022 19:45:53 -0600 Subject: [PATCH] Fix another regression caused by #609. If a problem sets the answer to be a formula with an assigment, (something like `Formula("x = 5")` then all answers are counted incorrect and a warning is displayed that the evaluated answer is not an answer hash. This worked prior to #609. The cause of this was the removal of a line that should not have been removed that converts the other answer being compared to to a Formula if it is not already. Note that the original issue that was attempted to be fixed by #609 still is fixed with this change. This fixes issue #644 that I just submitted about this. --- macros/parserAssignment.pl | 1 + 1 file changed, 1 insertion(+) diff --git a/macros/parserAssignment.pl b/macros/parserAssignment.pl index 4e2ec2baa7..763f09e840 100644 --- a/macros/parserAssignment.pl +++ b/macros/parserAssignment.pl @@ -357,6 +357,7 @@ sub new { sub typeMatch { my $self = shift; my $other = shift; my $ans = shift; return 0 unless $self->type eq $other->type; + $other = $other->Package("Formula")->new($self->context,$other) unless $other->isFormula; my $typeMatch = $self->getTypicalValue($self)->{data}[1]; $other = $self->getTypicalValue($other,1)->{data}[1]; return 1 unless defined($other); # can't really tell, so don't report type mismatch