title: How to avoid irrelevant nullable warning (without explicit suppression)
body: <p>Is there a way to make the analyzer understand that the variable <code>Bar</code> has a value for the following case?</p>
  <pre><code>#nullable enable 
  class Foo {
     bool GenerateArray =&gt; Bar.HasValue;
     int? Bar { get; set; }
     void FooBar() {
       var data = (GenerateArray) ? new int[Bar.Value] : null;
     }
  }
  </code></pre>
  <p>There is the warning &quot;Nullable value type may be null.&quot; for <code>Bar.Value</code> but it obviously can't be.</p>
  <p>I am aware of two ways to avoid the warning. Both have disadvantages:</p>
  <ol>
  <li>Using <code>Bar.HasValue</code> directly instead of the property <code>GenerateArray</code>. However using <code>GenerateArray</code> improves readability.</li>
  <li>Using <code>Bar!.Value</code> instead of <code>Bar.Value</code>. However, if someone changes the code, for instance, by making <code>GenerateArray</code> an auto-property in the future, the warning may become relevant again, but won't appear.</li>
  </ol>
  <p>The problem here slightly differs from <a href="https://stackoverflow.com/questions/57432944">this question</a>, where a local variable was used instead of a property. The accepted answer below works (as soon as C# 9 is released) for the property but not for the local variable, if I understand it correctly. Hence, the question is not a duplicate.</p>