title: Kotlin recursive problem when type checking
body: <p>I have the following code which i think is valid, because the recursion happens as a result of a callback. It's not called directly as a result of the function call. But the compiler seems to think there is a recursion issue</p>
  <pre class="lang-kotlin prettyprint-override"><code>class Model(callBack: CallBack) {
      interface CallBack {
          fun onSomething()
      }
  }
  
  class SomeClass {
     fun createModel() = Model(callBack)
          
     val callBack = object : Model.CallBack {    
          override fun onSomething() {
              val anotherModel = createModel()
              // Use model for something
          }
     }
  }
  </code></pre>
  <pre><code>Type checking has run into a recursive problem. Easiest workaround: specify types of your declarations explicitly
  </code></pre>
  <p>Is there a workaround for this?</p>
  <p><strong>EDIT</strong></p>
  <p>I also tried changing <code>callBack</code> to a function so that the same instance is not referenced by multiple models, but I get the same error</p>