title: Extension functions for generic classes in Kotlin
body: <p>What's wrong with my extension function below</p>
  
  <pre><code>class Foo&lt;T&gt; {
      fun &lt;T&gt; Foo&lt;T&gt;.plus(that: Foo&lt;T&gt;): Foo&lt;T&gt; = throw Exception()
  
      init {
          Foo&lt;Int&gt;() + Foo&lt;String&gt;()  // A receiver of type Foo&lt;T&gt; is required
      }
  }
  </code></pre>
  
  <p><strong>Update</strong></p>
  
  <p>I wonder why it's different than regular extension functions, where T successfully gets inferred as <code>Any</code> and would like to achieve the same behavior, e. g. T to get inferred as Foo&lt;Any&gt;</p>
  
  <pre><code>class Foo {
      fun &lt;T&gt; T.foo(that: T): T = throw Exception()
  
      init {
          "str" foo 42
      }
  }
  </code></pre>