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

chore: improve ES Check type inference #5448

Merged
merged 1 commit into from
Nov 27, 2024

Conversation

kylezs
Copy link
Contributor

@kylezs kylezs commented Nov 26, 2024

Pull Request

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have written sufficient tests.
  • I have written and tested required migrations.
  • I have updated documentation where appropriate.

Summary

I hit an issue when writing a check like so on my PR:

number_of_open_elections_is(_pre, post, n: ElectionCount) {
	assert_eq!(post.unsynchronised_state.open_elections, n, "Number of open elections should be {}", n);
},

and it was because without explicitly comparing the whole post-state as is currently done on some Checks, it can't infer the rest of the state. Fixing this by explicitly providing the type in the closure, writing checks should remain just as clean.

@kylezs kylezs requested a review from dandanlen as a code owner November 26, 2024 10:40
Copy link

codecov bot commented Nov 26, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 72%. Comparing base (277b152) to head (f3eee8d).
Report is 7 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff           @@
##            main   #5448    +/-   ##
======================================
- Coverage     72%     72%    -0%     
======================================
  Files        490     490            
  Lines      87053   86929   -124     
  Branches   87053   86929   -124     
======================================
- Hits       62423   62242   -181     
- Misses     21675   21729    +54     
- Partials    2955    2958     +3     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@dandanlen dandanlen added this pull request to the merge queue Nov 26, 2024
@kylezs kylezs removed this pull request from the merge queue due to a manual request Nov 26, 2024
@kylezs kylezs added this pull request to the merge queue Nov 27, 2024
Merged via the queue into main with commit 197d3bd Nov 27, 2024
48 of 49 checks passed
@kylezs kylezs deleted the chore/improve-check-type-inference branch November 27, 2024 12:43
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.

2 participants