title: Kotlin generic function variance
body: <p>I have a class like follow:</p>
  <pre><code>class Weekend&lt;T : Any&gt; {
     
     fun &lt;R&gt; equal(property: KProperty1&lt;T, R&gt;, value: R?) {
        ...
        return this
     }
  }
  </code></pre>
  <p>and use the class like follow:</p>
  <pre><code>Weekend&lt;User&gt;().equal(User::name, &quot;username&quot;)
  </code></pre>
  <p>in this case, <code>User.name</code> is a string property, and &quot;username&quot; is also a string. But if I write the code like <code>Weekend&lt;User&gt;().equal(User::name, 22)</code>, kotlin will not give errors, because <code>string</code> and <code>Int</code> has the same parent <code>Compareble</code>.</p>
  <p>Is there any way to tell kotlin the second param <code>value</code> must be a <code>string</code> here? (I know <code>Weekend&lt;User&gt;().equal&lt;String&gt;(User::name, 22)</code> will work, but I want a simple way to do this.)</p>