title: Mypy does not detect errors regarding the use of NamedTuple inside functions
body: <p>In the following code the defintions of <code>x2</code> and <code>x3</code> are obviously wrong, yet mypy does not complain.</p>
  <pre><code>from typing import NamedTuple
  
  class X(NamedTuple):
      a: float
      b: float
      c: float
  
  def foo():
      x1 = X(1, 2, 3)
      x2 = X(1, 2)
      x3 = X(&quot;1&quot;, 2, 3)
      
  </code></pre>
  <p>If I remove the function declaration and put the three lines into the main file scope, then mypy correctly identifies both errors</p>
  <pre><code>from typing import NamedTuple
  
  class X(NamedTuple):
      a: float
      b: float
      c: float
  
  x1 = X(1, 2, 3)
  x2 = X(1, 2)
  x3 = X(&quot;1&quot;, 2, 3)
      
  </code></pre>
  <p>Why is that, what can I do about it?</p>
  <p>Im running
  python                    3.9.5
  mypy                      0.931</p>