Skip to content
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

Correctly specify nullability of Subject for NumericAssertions #2472

Open
vbreuss opened this issue Nov 19, 2023 · 3 comments
Open

Correctly specify nullability of Subject for NumericAssertions #2472

vbreuss opened this issue Nov 19, 2023 · 3 comments

Comments

@vbreuss
Copy link
Contributor

vbreuss commented Nov 19, 2023

Background and motivation

The Subject of NumericAssertions is always not-null, but because NullableNumericAssertions inherits from it, the subject was specified as nullable. This causes a lot of warnings (e.g. "Possible 'System.InvalidOperationException'").

I suggest to add a new base class NumericAssertionsBase which also gets the type of the subject and thus the NullableNumericAssertions now has a nullable subject and the subject of NumericAssertions is not-null.

Alternative Concerns

No response

Are you willing help with a pull-request?

Yes, please assign this issue to me.

@vbreuss
Copy link
Contributor Author

vbreuss commented Nov 19, 2023

I created a draft-PR to clarify, what my suggestion looks like.

@dennisdoomen
Copy link
Member

That draft PR seems to be using a ! a lot. How does it really improve the situation?

@vbreuss
Copy link
Contributor Author

vbreuss commented Nov 19, 2023

That draft PR seems to be using a ! a lot. How does it really improve the situation?

Sorry, I forgot to remove some unrelated changes. I updated the PR #2473 accordingly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants