Skip to content

Commit

Permalink
Fix: don't fail entire rewrite if recursive type did not match anywhe…
Browse files Browse the repository at this point in the history
…re at top-level
  • Loading branch information
Gegy committed Jan 25, 2024
1 parent b81c76b commit b81d8f1
Showing 1 changed file with 4 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,10 @@ public <T> DataResult<T> encode(final A input, final DynamicOps<T> ops, final T
@Override
public Optional<RewriteResult<A, ?>> everywhere(final TypeRewriteRule rule, final PointFreeRule optimizationRule, final boolean recurse, final boolean checkIndex) {
if (recurse) {
return family.everywhere(this.index, rule, optimizationRule).map(view -> (RewriteResult<A, ?>) view);
final Optional<RewriteResult<A, ?>> result = family.everywhere(this.index, rule, optimizationRule).map(view -> (RewriteResult<A, ?>) view);
if (result.isPresent()) {
return result;
}
}
return Optional.of(RewriteResult.nop(this));
}
Expand Down

0 comments on commit b81d8f1

Please sign in to comment.