-
Notifications
You must be signed in to change notification settings - Fork 388
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
Question about switch expression with ?? operator #1292
Comments
I took a quick peek and it really seems to be a bug. I created a simplified repro here: https://github.com/daveMueller/CoverletIssue1292 and I will start working on this. |
What if you try |
Thanks, but it's the same with I suspect the second branch is generated as the Nevertheless I have to look into which of the generated branch point we already exclude and which have to be excluded in addition. |
You are right, interesting 🤔 . From here https://stackoverflow.com/questions/56068105/what-happens-if-my-c-sharp-switch-expression-is-non-exhaustive:
But I see no warning in my code 😕 . Yes, after reading this I tried to pass Fully covered now! https://app.codecov.io/gh/graphql-dotnet/parser/compare/238/diff |
So actually it may be a question to Roslyn team. |
Yes I also started to think that this most likely isn't an issue with coverlet. Because you can fully cover the code when you know that it can throw an exception. E.g. the function
Can be fully covered with
When I looked into your code I also thought you handled all the bad cases up front (e.g. with ??) and thats why there is no warning anymore. So I also don't really understand why the compiler still generates the exception. Maybe this really is a Roslyn issue. Nevertheless I don't think that coverlet has an issue here anymore. |
There was no case for null in my switch. |
Yes you are right. |
Closing this because coverlet works as designed. Feel free to reopen. |
See https://app.codecov.io/gh/graphql-dotnet/parser/blob/master/src/GraphQLParser/ParserContext.Parse.cs
All 4 usages of
ExpectOneOf
(lines 862, 1101, 1114, 1353) are partilly covered though there are tests that callExpectOneOf
with null and non-null values. Why so?The text was updated successfully, but these errors were encountered: