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

Improve missing field error message #566

Merged
merged 1 commit into from
Jan 24, 2024
Merged

Improve missing field error message #566

merged 1 commit into from
Jan 24, 2024

Conversation

denismerigoux
Copy link
Contributor

No description provided.

@denismerigoux denismerigoux added ✨ enhancement New feature or request 🔧 compiler Issue concerns the compiler labels Jan 23, 2024
@denismerigoux denismerigoux self-assigned this Jan 23, 2024
if
StructField.Map.exists
(fun expected_f _ -> not (StructField.Map.mem expected_f s_fields))
expected_s_fields
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I generally find it nicer to write let missing = Map.diff expected fields in if not (Map.is_empty missing) then ..., but it's generally less efficient and well Map doesn't have a proper diff function (although you can use merge for that 🤷) so this is fine ;)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I didn't know you coud use Map.merge to implement some sort of Map.diff. I'll remember it next time :)

@denismerigoux denismerigoux merged commit 45a2aec into master Jan 24, 2024
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🔧 compiler Issue concerns the compiler ✨ enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants