Skip to content

Commit

Permalink
Merge pull request #609 from drdrew42/bugfix/607-parser-assignment
Browse files Browse the repository at this point in the history
parserAssignment chokes when previous answer is undefined on the domain
  • Loading branch information
drgrice1 authored Dec 2, 2021
2 parents 76ba414 + 0e591bf commit ff6c945
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions macros/parserAssignment.pl
Original file line number Diff line number Diff line change
Expand Up @@ -348,17 +348,16 @@ sub new {
my $self = shift; $class = ref($self) || $self;
my $f = $self->SUPER::new(@_);
bless $f, $class if $f->type eq 'Assignment';
my $rhs = $f->getTypicalValue($f)->{data}[1];
Value->Error('Assignment of strings is not allowed.') if $rhs && $rhs->type eq 'String';
return $f;
}

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->createRandomPoints(1))[1]->[0]{data}[1];
$main::__other__ = sub {($other->createRandomPoints(1))[1]->[0]{data}[1]};
$other = main::PG_restricted_eval('&$__other__()');
delete $main::{__other__};
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
$typeMatch->typeMatch($other,$ans);
}
Expand Down

0 comments on commit ff6c945

Please sign in to comment.