title: Kotlin sealed class and type inference
body: <p>im using a sealed class to report back success or error to client code:</p>
  
  <pre><code>sealed class Result&lt;out T : Any&gt; {
      data class Success&lt;out T : Any&gt;(val data: T) : Result&lt;T&gt;()
      data class Error(val exception: Exception) : Result&lt;Nothing&gt;()
  }
  </code></pre>
  
  <p>But im stuck getting even the simplest unit test to compile using it:</p>
  
  <pre><code>    val error = Result.Error(IOException("message"))
      assertThat(error, instanceOf(Result.Error::class.java))
  </code></pre>
  
  <p>I get the message : Type Inference failed. Not enough information to infer parameter T in fun  instanceOf(type : Class&lt;*>) : Matcher!</p>
  
  <p>Looks like im missing something important in Kotlin.</p>
  
  <p>Thanks for helping me out!</p>