Repository navigation
refactor: drop the GuaranteesNotNull markings that can never suppress anything - #1097
Merged
Merged
Conversation
vbreuss
force-pushed
the
refactor/drop-inert-guarantees-not-null
branch
from
September 14, 2026 13:34
23a8fdf to
c834e5d
Compare
Contributor
Test Results 23 files 23 suites 9m 38s ⏱️ Results for commit 6060750. ♻️ This comment has been updated with latest results. |
Contributor
🚀 Benchmark ResultsDetails
|
vbreuss
force-pushed
the
refactor/drop-inert-guarantees-not-null
branch
from
September 14, 2026 14:26
c834e5d to
2bd1de8
Compare
Base automatically changed from
refactor/nullable-non-generic-enumerable-subject
to
main
September 14, 2026 14:27
… anything The attribute has one mechanical effect: `IsNotNullSuppressor` reads it and drops a CS8600, CS8602, CS8604 or CS8629 on the subject. A subject that cannot be `null` - `ImmutableArray<T>`, `TimeSpan`, `DateTime`, `bool`, a `TNumber` constrained to `struct`, or a concrete `float`/`double` overload - never raises one, so 226 of the 769 markings did nothing. They were also invisible to the sweep, which skips a subject it cannot make `null`, so they were neither invoked nor verified. At nearly a third of all markings that dilutes the signal, and it shifts how the attribute reads: from a suppression directive into documentation that an expectation rejects `null`. That drift is how a marking reaches a reference type it does not hold for, and there the cost is a real CS8602 dropped in a user's code. `EveryMarkedExpectation_ShouldHaveASubjectThatCanBeNull` now rejects such a marking, which makes the rule self-enforcing. It asks about the subject rather than the receiver, because a receiver like `ThatSubject<T>` is a struct that wraps a subject which can be `null` - `Is` and `IsExactly` are marked for exactly that reason. The non-nullable `IsNotBetween` overloads that #1092 marked to keep each file symmetrical are covered by it too.
vbreuss
force-pushed
the
refactor/drop-inert-guarantees-not-null
branch
from
September 14, 2026 14:38
2bd1de8 to
6060750
Compare
|
github-actions Bot
added a commit
that referenced
this pull request
Sep 14, 2026
…rkings that can never suppress anything (#1097) by Valentin Breuß
github-actions Bot
added a commit
that referenced
this pull request
Sep 14, 2026
…rkings that can never suppress anything (#1097) by Valentin Breuß
Contributor
👽 Mutation ResultsaweXpectDetails
The final mutation score is 88.95%Coverage Thresholds: high:80 low:60 break:0aweXpect.CoreDetails
The final mutation score is NaN%Coverage Thresholds: high:80 low:60 break:0 |
This was referenced Oct 12, 2026
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.



The attribute has one mechanical effect:
IsNotNullSuppressorreads it and drops a CS8600, CS8602, CS8604 or CS8629 on the subject. A subject that cannot benull-ImmutableArray<T>,TimeSpan,DateTime,bool, aTNumberconstrained tostruct, or a concretefloat/doubleoverload - never raises one, so 209 of the 735 markings did nothing.They were also invisible to the sweep, which skips a subject it cannot make
null, so they were neither invoked nor verified. At more than a quarter of all markings that dilutes the signal, and it shifts how the attribute reads: from a suppression directive into documentation that an expectation rejectsnull. That drift is how a marking reaches a reference type it does not hold for, and there the cost is a real CS8602 dropped in a user's code.EveryMarkedExpectation_ShouldHaveASubjectThatCanBeNullnow rejects such a marking, which makes the rule self-enforcing. It asks about the subject rather than the receiver, because a receiver likeThatSubject<T>is a struct that wraps a subject which can benull-IsandIsExactlyare marked for exactly that reason.