-
Notifications
You must be signed in to change notification settings - Fork 33
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
Suppress nullability warnings after Is.Not.Null constraint #157
Comments
I can definitely see the benefit of this, but also the complexity if we want to handle more than the most basic cases, as we would have to implement the same flow analysis as in the compiler. So the easiest is probably to start with the most basic example and then build upon this. |
The only concern is - doing that would probably require to drop VS2017 support (or provide separate package for VS2017). |
I'm looking into the use of a DiagnosticsSuppressor. |
As discussed here nunit/nunit#3376 (comment), it would be great to suppress nullability warnings after Is.Not.Null asserts, e.g.
Unfortunately, we cannot impact roslyn's nullability analysis, only suppress analyzers (see dotnet/roslyn#32042 (comment)), which means that at least very basic logic should be re-invented.
Cases that I think should be covered:
Assert.That(obj?.PropA?.PropB, Is.Not.Null)
Assert.That(obj, Is.Not.Null & Is.Not.Empty)
Assert.That(obj, Is.Not.Null.And.Not.Empty)
The text was updated successfully, but these errors were encountered: