chore: declare record-synthesized public API to clear RS0016#1176
Merged
Conversation
The PublicApiAnalyzers 3.3.4 -> v5 bump (#1014) started reporting the compiler-generated members of public records (Deconstruct, Equals, GetHashCode, ToString, operator ==/!=, <Clone>$, copy-ctors, EqualityContract), which 3.3.4 suppressed. That surfaced ~1200 RS0016 warnings across Koine.Compiler (1153), Koine.Emit.Docs (40) and Koine.Emit.Common (7). RS0016 is a deliberate gate here (only silenced for the ANTLR generated lexer/parser files) so unintended public API cannot ship silently. Blanket-suppressing it would also stop catching genuinely-forgotten hand-written public members, so instead declare the members in each project's PublicAPI.Unshipped.txt -- the analyzer's own code-fix behavior. All 1200 entries are verified record-synthesized boilerplate; no hand-written API was among them. Solution build is now warning-clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Declares the compiler-generated members of the public
recordtypes in each project'sPublicAPI.Unshipped.txt, clearing ~1200RS0016warnings.Why
The
Microsoft.CodeAnalysis.PublicApiAnalyzers3.3.4 → v5 bump (#1014) started reporting the members the C# compiler auto-generates for a publicrecord—Deconstruct,Equals,GetHashCode,ToString,operator ==/!=,<Clone>$, copy-constructors,EqualityContract— which3.3.4had suppressed. That surfaced RS0016 across three projects:Koine.CompilerKoine.Emit.DocsKoine.Emit.CommonThey were warnings only (
TreatWarningsAsErrorsis intentionally off), but RS0016 is a deliberate gate — the root.editorconfigsilences it only for the ANTLR-generated lexer/parser files, andKoine.Compiler.csprojdocuments it as "unintended public API cannot ship silently."Approach
Declared the members — the analyzer's own code-fix behavior — rather than blanket-suppressing RS0016 (which would also stop catching genuinely-forgotten hand-written public members; there is no config to exclude record members selectively). Each symbol was attributed to its declaring project by the
[…csproj]diagnostic suffix and appended verbatim (sorted, deduped).Verification: all 1200 entries confirmed record-synthesized boilerplate — no hand-written API among them.
dotnet build Koine.slnx→ 0 warnings, 0 errors. Diff is purely additive to the three contract files; no source touched.Note
Because v5 now tracks these, a future change to a record's parameter list will re-trip RS0016 for its regenerated members, so those
Unshipped.txtentries will need updating alongside.