title: Compiler error "Incorrect number of type arguments to local call"
body: <p>I'm running into the compiler error "Incorrect number of type arguments to local call" when using custom types with unit-of-measure type arguments, and I do not understand why.</p>
  
  <p><em>This question has undergone quite a few edits. It looks likely now that the error is caused by a compiler or IDE bug.</em></p>
  
  <p>I could narrow it down to the following <strong>(read the points below when trying to reproduce)</strong>:</p>
  
  <pre><code>type R&lt;[&lt;Measure&gt;] 'u&gt; (f : float&lt;'u&gt;) =
      member r.Member = f
  
  let get (r : R&lt;_&gt;) = r.Member
  let foo =
      let problem _ = List.map get
      problem // Error: Incorrect number of type arguments to local call
  </code></pre>
  
  <p>The last line gives the error, which is especially weird, since it is doing nothing more than returning an already-defined identifier. I am compiling to a library or executable. Some important observations for reproduction:</p>
  
  <ul>
  <li><p>IntelliSense does <em>not</em> predict this error. An actual compilation is required to see it.</p></li>
  <li><p>I haven't yet seen the error when compiling with optimization. (For reproduction, use e.g. the default debug compile in Visual Studio. Thanks to zapu on Freenode for pointing this out.)</p></li>
  <li><p>I haven't yet seen the error in F# interactive.</p></li>
  <li><p>Removing the useless parameter of <code>problem</code> (the <code>_</code>) makes the error disappear.</p></li>
  <li><p>Moving the let-binding of <code>problem</code> out of <code>foo</code> makes the error disappear. <em>Might this be related to compilation as an F# function? I heard that this is indicated by additional parentheses around the type of</em> <code>problem</code>.</p></li>
  <li><p>Removing the unit-of-measure usage makes the error disappear.</p></li>
  <li><p>Marking <code>problem</code> as <code>inline</code> makes the error disappear.</p></li>
  </ul>
  
  <p>A lot of seemingly irrelevant changes remove the error. But it isn't that easy in the actual use case, especially when I don't know whether a change fixes the error before I try it.</p>
  
  <p>I'd be happy about any hints on this. What causes it? Is it a bug, and if so, is it known? How can it be avoided?</p>
  
  <p><strong>Versions</strong> This was tested with versions from 3.0 to 3.1.2 of F#. I installed the new Visual Studio 2013 Community edition and tested with the version it supplied, with the same result. It also occurs in Visual Studio 2012 (F# 3.0).</p>
  
  <p>Update: I've asked others to test this, and the behavior can often be reproduced in Visual Studio 2012 or 2013.</p>