title: How does ReSharper know "Expression is always true"?
body: <p>Check out the following code:</p>
  <pre><code>private void Foo(object bar)
  {
     Type type = bar.GetType();
  
      if (type != null) // Expression is always true
      {   
      }
  }
  </code></pre>
  <p>ReSharper claims <code>type</code> will never be <code>null</code>. That's obvious to me because there's always going to be a type for <code>bar</code>, but how does ReSharper know that? How can it know that the result of a method will never be <code>null</code>?</p>
  <p><code>Type</code> is not a struct so it can't be that. And if the method were written by me, then the return value could certainly be <code>null</code> (not necessarily GetType, but something else).</p>
  <p>Is ReSharper clever enough to know that, for only that particular method, the result will never be <code>null</code>? (Like there's a hard-coded list of known .NET methods which will never return null.)</p>