have with_actions return the recheck list
Matt S Trout [Sun, 26 Jun 2016 17:48:45 +0000 (17:48 +0000)]
lib/DX/Hypothesis.pm

index 5e9a147..931cd0c 100644 (file)
@@ -31,15 +31,16 @@ sub with_actions {
     return undef unless $hyp;
     push @events, @these_events;
   }
-  $hyp = $hyp->but_recheck_for(@events);
-  return $hyp;
+  my ($still_resolved, @recheck) = $hyp->resolved_propositions
+                                       ->but_expire_for(@events);
+  return (
+    $hyp->but(resolved_propositions => $still_resolved),
+    @recheck
+  );
 }
 
 sub but_recheck_for {
-  my ($self, @events) = @_;
-  my ($still_resolved, @recheck) = $self->resolved_propositions
-                                        ->but_expire_for(@events);
-  return $self unless @recheck;
+  my ($self, @recheck) = @_;
 
   my $ap = DX::ActionPolicy::LockScope->new(
     lock_to_depth => $self->scope->depth,
@@ -76,7 +77,7 @@ sub but_recheck_for {
 
   my $sol_rps = $sol_ss->current_hypothesis->resolved_propositions;
 
-  my $rps = $still_resolved;
+  my $rps = $self->resolved_propositions;
 
   $rps = $rps->with_updated_dependencies_for(
     $_, $sol_rps->dependencies_for($_)
@@ -89,8 +90,12 @@ sub but_recheck_for {
 
 sub with_resolution {
   my ($self, $prop, $depends, $actions) = @_;
-  my $hyp = $self->with_actions(@$actions);
+  (my $hyp, my @recheck) = $self->with_actions(@$actions);
   return undef unless $hyp;
+  if (@recheck) {
+    $hyp = $hyp->but_recheck_for(@recheck);
+    return undef unless $hyp;
+  }
   $hyp->but(
     resolved_propositions => $self->resolved_propositions
                                   ->with_resolution_for(