switch to preserving original step in alt list
Matt S Trout [Mon, 13 Feb 2017 20:33:35 +0000 (20:33 +0000)]
lib/DX/Step/Backtrack.pm
lib/DX/Step/ResolveProposition.pm
lib/DX/Types.pm

index 5d3c339..9c489fa 100644 (file)
@@ -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,
   );
 }
index 96fdc3a..e56b19c 100644 (file)
@@ -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}
         ])
       : ()
index 9d2e360..8c2602a 100644 (file)
@@ -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) {