From: Matt S Trout Date: Mon, 13 Feb 2017 20:33:35 +0000 (+0000) Subject: switch to preserving original step in alt list X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=38113b884bbffe33c7d694931d062e710fbb711c;p=scpubgit%2FDX.git switch to preserving original step in alt list --- diff --git a/lib/DX/Step/Backtrack.pm b/lib/DX/Step/Backtrack.pm index 5d3c339..9c489fa 100644 --- a/lib/DX/Step/Backtrack.pm +++ b/lib/DX/Step/Backtrack.pm @@ -9,9 +9,9 @@ sub apply_to { my ($first_alt, @rest_alt) = @{$ss->alternatives}; return $ss->but(next_step => $ss->on_exhaustion_step) unless $first_alt; return $ss->but( - current_hypothesis => $first_alt->[0], + current_hypothesis => $first_alt->[1], alternatives => \@rest_alt, - next_step => $first_alt->[1], + next_step => $first_alt->[0]->alternative_step, is_solution_state => 0, ); } diff --git a/lib/DX/Step/ResolveProposition.pm b/lib/DX/Step/ResolveProposition.pm index 96fdc3a..e56b19c 100644 --- a/lib/DX/Step/ResolveProposition.pm +++ b/lib/DX/Step/ResolveProposition.pm @@ -57,7 +57,7 @@ sub apply_to { next_step => $ns, ($alt_step ? (alternatives => [ - [ $old_ss->current_hypothesis, $alt_step ], + [ $self, $old_ss->current_hypothesis ], @{$old_ss->alternatives} ]) : () diff --git a/lib/DX/Types.pm b/lib/DX/Types.pm index 9d2e360..8c2602a 100644 --- a/lib/DX/Types.pm +++ b/lib/DX/Types.pm @@ -33,7 +33,7 @@ foreach my $role (our @ROLES) { class_type DictValue => { class => 'DX::Value::Dict' }; -declare AlternativeList => as ArrayRef[Tuple[Hypothesis, Step]]; +declare AlternativeList => as ArrayRef[Tuple[Step, Hypothesis]]; declare DependencyType => where { foreach my $cand (EXISTENCE_OF, TYPE_OF, INDICES_OF, CONTENTS_OF) {