[return: NotNullIfNotNull(paramName)] is a semi-common attribute to use, especially in some code bases that like to use:
if (input == null) return null;
at the start of many functions.
Unlike [NotNullWhen(bool)] for out parameters, I don't see a clean way to infer NotNullIfNotNull with our current algorithm.
But it would be valuable to figure something out, so I'm creating this issue to collect some cases of [NotNullIfNotNull] methods and their constraint graphs.
[return: NotNullIfNotNull(paramName)]is a semi-common attribute to use, especially in some code bases that like to use:if (input == null) return null;at the start of many functions.
Unlike
[NotNullWhen(bool)]for out parameters, I don't see a clean way to inferNotNullIfNotNullwith our current algorithm.But it would be valuable to figure something out, so I'm creating this issue to collect some cases of
[NotNullIfNotNull]methods and their constraint graphs.