title: Add multiple constraints to a generic function definition (why must I inline)?
body: <p>I want to add 2 constraints to my generic function. a constructor constraint and a member constraint.</p>
  
  <pre><code>let somefn&lt;'T when 'T : (new : unit -&gt;  'T) and 'T : (member Add : 'T -&gt; unit)&gt; v = new 'T()
  </code></pre>
  
  <p>However I am getting the following error:</p>
  
  <pre><code>/stdin(32,5): error FS0670: This code is not sufficiently generic. 
  The type variable  ^T when  ^T : (new : unit -&gt;   ^T) and  
                              ^T : (member Add :  ^T *  ^T -&gt; unit) 
  could not be generalized because it would escape its scope.
  </code></pre>
  
  <p>I really don't understand this error message.</p>
  
  <p>Only if I change the definition to:</p>
  
  <pre><code>let inline somefn&lt;'T when 'T : (new : unit -&gt;  'T) and 'T : (member Add : 'T -&gt; ...
  </code></pre>
  
  <p>It starts working.</p>
  
  <p>Can anybody explain this. </p>