title: Calling generics method argument in kotlin
body: <pre><code>fun &lt;T&gt; doSum(a: T, b: T) : T {
      val result : Number = when {
          a is Int &amp;&amp; b is Int -&gt; a + b
          a is Long &amp;&amp; b is Long -&gt; a + b
          a is Float &amp;&amp; b is Float -&gt; a + b
          a is Double &amp;&amp; b is Double -&gt; a + b
          else -&gt; throw IllegalArgumentException() 
  
      @Suppress("UNCHECKED_CAST")
      return result as T
  }
  
  fun &lt;T: Number&gt; doOperation(a: T, b: T, operationToPerform: (T, T) -&gt; T ) {
      println(operationToPerform(a, b))
  }
  </code></pre>
  
  <p>I have the method doOperations that takes a generics function as a parameter that I intend to run on the other 2 parameters passed. 
  However, invoking the same in main as : </p>
  
  <pre><code>fun main(args: Array&lt;String&gt;) {
      doOperation (2, 3, doSum)
  }
  </code></pre>
  
  <p>is returning errors like: </p>
  
  <pre><code>Error:(15, 24) Kotlin: Function invocation 'doSum(...)' expected
  Error:(15, 24) Kotlin: No value passed for parameter 'a'
  Error:(15, 24) Kotlin: No value passed for parameter 'b'
  </code></pre>
  
  <p>Any suggestions on the way to call doOperation with doSum()? </p>
  
  <p>(&amp; changing &lt; T > doSum to &lt; T: Number > doSum throws up one more error: 
  Error:(15, 24) Kotlin: Type parameter bound for T in fun  doSum(a: T, b: T): T
   is not satisfied: inferred type (Int, Int) -> Int is not a subtype of Number)</p>