Repository navigation
Read a covariant return override as an override - #98
Merged
Merged
Conversation
C# emits an override with a covariant return type as a new virtual slot marked with PreserveBaseOverridesAttribute, so the reader showed it as virtual. Roslyn reads it as an override, and so does the reader now; the comparison then treats it as one too, such as an override that is removed being still found through the base. The samples gain a covariant override and a sealed record that derives from another, which the Roslyn oracle checks. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Mpdreamz
added a commit
that referenced
this pull request
Nov 14, 2026
The libraries now use their own feature. `api/` holds the public API of `Nullean.PublicApi` and `Nullean.PublicApi.Diff` as `.api` files, written by the tool built from this checkout. So from now on, a change to either library's API shows up in its pull request as a diff of those files. - **Two files for `Nullean.PublicApi`:** its API differs between netstandard2.0 and net10.0. Covariant return types need .NET 5 or later, so on netstandard2.0 the records' `<Clone>$` returns the base type (`public override ApiTypeReference <Clone>$()` instead of `public override ApiArrayType <Clone>$()`). Generating these files is how #98 was found. - **`./build.sh ci` and CI's build job run `verifyapi`:** CI calls the targets one by one, so `verifyapi` is its own step there, and the run on this branch printed `[api] api matches the build: 3 files` on Linux. The target fails when the build no longer matches `api/`. `mise run api` regenerates the files after an intended change, and AGENTS.md says to commit them with that change. CI runs the tool from the checkout, because the released `verify-api` action can't run `api` until the next release. - **The update command `--verify` prints** now carries the `--project`, `--include-tests` and `--include-unpackable` options it was run with. Checked locally: `verifyapi` passes on this branch. With a public method added to `ApiWriter` it fails with exit 5: ``` [api] Nullean.PublicApi.net10.0: 1 change since the committed files, suggested version change: Minor api/Nullean.PublicApi.net10.0.api:457 Nullean.PublicApi › ApiWriter › Probe() added public static int Probe() [minor] [api] Nullean.PublicApi.netstandard2.0: 1 change since the committed files, suggested version change: Minor api/Nullean.PublicApi.netstandard2.0.api:457 Nullean.PublicApi › ApiWriter › Probe() added public static int Probe() [minor] [api] api does not match the build. Suggested version change: Minor ``` 🤖 Generated with [Claude Code](https://claude.com/claude-code) --------- Co-authored-by: Claude Opus 5.5 <[email protected]>
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.
Generating the libraries' own
.apifiles turned up a reader bug: on net10.0, the records'<Clone>$showed aspublic virtual ApiArrayType <Clone>$()instead of an override.C# emits an override with a covariant return type as a new virtual slot. It marks the slot with
PreserveBaseOverridesAttributeso the runtime still treats it as overriding the base method. The reader took the new slot at face value. Roslyn reads it as an override, and now so does the reader:The Roslyn oracle missed it because none of the six framework assemblies has a covariant override in its public API. The samples now include a covariant override and a sealed record deriving from another record. Without the fix, the oracle fails on them:
The JustAssembly-compatible reports are unchanged: all 617 tool tests pass.
🤖 Generated with Claude Code