Open Evangelink opened 4 years ago
cc @mavasani
I believe it cannot be null. Tagging @333fred @AlekseyTs to confirm.
I believe that is correct. @jaredpar, this an example of where annotating IOperation would be useful.
Thank you all for the answers!
@mavasani I will remove the null checks on the 2 linked ticket in roslyn-analyzers
if that's ok for you.
@333fred Is there something I could help with?
@Evangelink if you wanted to take a stab at annotating IOperation interfaces, you'd be more than welcome to do so. We have a general doc on annotating here: https://github.com/dotnet/roslyn/blob/master/docs/contributing/Nullable%20Annotations.md. The basic strategy for IOperation that I've come up with is to start with the leaf nodes, annotate those, and then work up the tree. Annotating this is basically an investigation into the C# and VB behavior of the BoundTree, seeing what elements correspond to what IOperation elements, and annotating appropriately. For example, there are fields that might never be null in C#, but might be null in VB, and vice versa.
@333fred Let me know if I got things right. Let's say I want to ensure that the Parameter
property of IArgumentOperation
is never null. I look at all the types implementing the interface, then to all path leading to the property being set (for C# and vbnet) and if they are all not null then that's ok to mark the property as not null? The interface being auto-generated, how shall I mark it as non-null?
@Evangelink it would require changing the generator to understand nullability. To be frank, if that sounds like to much work I understand, it's why we haven't done it yet. We'll get to it in the next few months.
I totally get it 😄😄😄
Honestly, I'd be happy to help but I am afraid to have you spend a lot of time answering my questions so I don't know if this would end up being advantageous for you.
Hi,
The
IArgumentOperation
operation has aParameter
property, are we ensured that the result is never null? If not could you please give some info toward when this could be null?I'd like to increase the coverage of one analyzer, so I either need to remove the null check or add a unit-test.
See https://github.com/dotnet/roslyn-analyzers/issues/3115
Thank you