Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Small fixes for recursive data fixers #84

Merged
merged 3 commits into from
Jan 24, 2024
Merged

Small fixes for recursive data fixers #84

merged 3 commits into from
Jan 24, 2024

Conversation

Gegy
Copy link
Member

@Gegy Gegy commented Jan 19, 2024

Two small issues:

  • When applying DataFixerUpper on some recursive root type, and there is a data fixer that fixes that root type, that type will not be recursively fixed.
  • When using writeFixAndRead/writeAndRead with a recursive type, the fixer function itself is invoked with sub-types already upgraded; but we try to parse this typed structure with the input type. We need to instead 'patch' those sub-types to the new types within the input type. TypeRewriteRule already knows how to do that, so we can capture the type from this.

If using the unfolded type instead of the recursive point, a fixer applying to that type will rewrite the entire type without a fold, causing it to only fix the top-level.
…vely

This type is used to encode the Typed structure to data, and matches the type that the fixer actually gets passed. Otherwise, we try to encode the sub-values with the old format, which fails.
@Gegy Gegy self-assigned this Jan 19, 2024
@Fantastime Fantastime self-requested a review January 22, 2024 09:09
@billybong billybong self-requested a review January 22, 2024 09:09
fry-mojang
fry-mojang previously approved these changes Jan 22, 2024
@Gegy Gegy merged commit b81c76b into master Jan 24, 2024
2 checks passed
@Gegy Gegy deleted the fix/recursive-fixing branch January 24, 2024 09:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants