Reports inline functions with non-nullable extension receivers which don't use the fact that extension receiver is not nullable.

Before Kotlin 1.2, calls of inline fun with flexible nullable extension receiver (a platform type with an unknown nullability) did not include nullability checks in bytecode. Since Kotlin 1.2, nullability checks are included into the bytecode (see KT-12899).

Thus functions which do not use the fact that extension receiver is not nullable are dangerous in Kotlin until 1.2 and it's recommended to make such functions to have nullable receiver.

Example:


  inline fun String.greet() {
      println("Hello, $this!")
  }

  fun main() {
      // `System.getProperty` returns not denotable `String!` type
      val user = System.getProperty("user.name")
      user.greet()
  }

After the quick-fix is applied:


  inline fun String.greet() {
      println("Hello, $this!")
  }

  fun main() {
      // `System.getProperty` returns not denotable `String!` type
      val user = System.getProperty("user.name")
      user.greet()
  }

This inspection only reports if the Kotlin language level of the project or module is lower than 1.2.