Skip to content

Dedupe symbol count fields in pyrefly coverage#3771

Closed
jorenham wants to merge 1 commit into
facebook:mainfrom
jorenham:coverage/dedupe-symbol-counts
Closed

Dedupe symbol count fields in pyrefly coverage#3771
jorenham wants to merge 1 commit into
facebook:mainfrom
jorenham:coverage/dedupe-symbol-counts

Conversation

@jorenham

Copy link
Copy Markdown
Contributor

Summary

The ModuleReport and ReportSummary structs both had the same 8 n_{symbol} count fields, which were modified in collect.rs one by one in three functions. So if you wanted to add a new symbol counter, you'd have to do so in 5 places.

This dedupes these fields using he same #[serde(flatten)] trick used for the "slot" (typable) counts.

This is purely a refactor; so there are no behavior changes.

This shouldn't cause any merge conflicts with #3747.

Test Plan

Tests still pass.

@github-actions

Copy link
Copy Markdown

According to mypy_primer, this change doesn't affect type check results on a corpus of open source code. ✅

@NathanTempest NathanTempest left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks @jorenham for your continued refactoring and improvements in pyrefly coverage. Pulling the eight repeated count fields into SymbolCounts with #[serde(flatten)] mirrors the existing SlotCounts pattern perfectly, and I confirmed it's output-identical (2 files changed, zero snapshot diffs). The merge() helper cleanly replaces the manual summation, and the n_type_ignores preservation in filter_module_report_to_public is handled correctly. LGTM, importing and merging.

@meta-codesync

meta-codesync Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@NathanTempest has imported this pull request. If you are a Meta employee, you can view this in D108620077.

@yangdanny97 yangdanny97 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Review automatically exported from Phabricator review in Meta.

@meta-codesync meta-codesync Bot closed this in e4ad5a5 Jun 15, 2026
@meta-codesync meta-codesync Bot added the Merged label Jun 15, 2026
@meta-codesync

meta-codesync Bot commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

@NathanTempest merged this pull request in e4ad5a5.

@jorenham jorenham deleted the coverage/dedupe-symbol-counts branch June 15, 2026 16:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants