-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
'is not' and [DoesNotReturn] #57798
Comments
I couldn't figure out the best area label to add to this issue. If you have write-permissions please help me learn by adding exactly one area label. |
|
@333fred Sorry to ping you but I have the feeling noone's ever going to read this thread now that you closed it. You only addressed half of the issue here, why does it work for a nested function ? Is that also 'by design' ? |
Yes, that is also by design. That's not the attribute doing anything at all: while definite assignment cannot do whole program analysis (as we can't solve the halting problem) it can look inside local functions. You can see in this example that, even with the attribute removed, definite assignment can pay attention to the body of the local function. |
Description
Functions with the
[DoesNotReturn]
attribute are not handled correctly with theis not
operator.Reproduction Steps
Expected behavior
list
must be defined, because of the[DoesNotReturn]
attribute.Actual behavior
CS0165: Use of unassigned local variable 'list'
Regression?
Didn't test previous versions.
Known Workarounds
Surprisingly, declaring the function as nested does work.
Configuration
Using .Net 6 on Windows 10, VS Code.
Other information
No response
The text was updated successfully, but these errors were encountered: