Preconditions should activate smart cast, no?

Consider the following example:

fun test(s: String?): String {
    require(s != null)
    return s!!  // null check is still required here

shouldn’t s be smart-casted after the precondition check?

Require is a regular function so the compiler doesn’t “know” that it throws on a false parameter. You will have to wait for the contract work to be complete.

More details about that here: Status of kotlin.internal.contracts?