Unreachable code?

Kotlin code:

``

package controllers

native trait Todo {
  fun deleteRecord() = noImpl   // no return type here
  fun get(key: String): Commit = noImpl
}

native trait Commit {
  fun commit()
}

native(“Ember.Controller”) trait EmberController {
  fun set(key: String, value: Any) = noImpl
  fun get(key: String): Any = noImpl
}

class TodoController: EmberController {
  var isEditing: Boolean = false
  fun editTodo() {
  this.set(“isEditing”, true)
  }
  fun removeTodo () {
  var todo = this.get(“model”) as Todo
  todo.deleteRecord()
  todo.get(“store”).commit()  // !!! can’t compiled, error: Unreachable code
  }
}

I don’t know why it reports “Unreachable code”.

If I change:

``

fun deleteRecord() = noImpl 

to

fun deleteRecord():Any = noImpl

It will be OK

Is it a bug ?

It is not a bug. noImpl is guaranteed to throw an exception, and its precise type (Nothing) reflects this fact. Unless you remove this type information by making the type Any, the compiler thinks that noImpl will be called and reports unreachable code.