Skip to content

Commit ff6c945

Browse files
authored
Merge pull request #609 from drdrew42/bugfix/607-parser-assignment
parserAssignment chokes when previous answer is undefined on the domain
2 parents 76ba414 + 0e591bf commit ff6c945

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

macros/parserAssignment.pl

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -348,17 +348,16 @@ sub new {
348348
my $self = shift; $class = ref($self) || $self;
349349
my $f = $self->SUPER::new(@_);
350350
bless $f, $class if $f->type eq 'Assignment';
351+
my $rhs = $f->getTypicalValue($f)->{data}[1];
352+
Value->Error('Assignment of strings is not allowed.') if $rhs && $rhs->type eq 'String';
351353
return $f;
352354
}
353355

354356
sub typeMatch {
355357
my $self = shift; my $other = shift; my $ans = shift;
356358
return 0 unless $self->type eq $other->type;
357-
$other = $other->Package("Formula")->new($self->context,$other) unless $other->isFormula;
358-
my $typeMatch = ($self->createRandomPoints(1))[1]->[0]{data}[1];
359-
$main::__other__ = sub {($other->createRandomPoints(1))[1]->[0]{data}[1]};
360-
$other = main::PG_restricted_eval('&$__other__()');
361-
delete $main::{__other__};
359+
my $typeMatch = $self->getTypicalValue($self)->{data}[1];
360+
$other = $self->getTypicalValue($other,1)->{data}[1];
362361
return 1 unless defined($other); # can't really tell, so don't report type mismatch
363362
$typeMatch->typeMatch($other,$ans);
364363
}

0 commit comments

Comments
 (0)