ReplaceWith usage for extension properties

I’m trying to replace our custom setGone() method with the Android KTX version. When I use this, it just deletes the line and adds an import.

@Deprecated("Use Android KTX - `.isGone = true`", ReplaceWith("this.isGone = true", "androidx.core.view.isGone"))
fun View.setGone() {
    visibility = View.GONE
}

The isGone is defined as follows in KTX -

inline var View.isGone: Boolean
    get() = visibility == View.GONE
    set(value) {
        visibility = if (value) View.GONE else View.VISIBLE
    }

Any suggestions on how to make this work?

1 Like

Looks like https://youtrack.jetbrains.com/issue/KT-21131 . This should be fixed in Kotlin 1.2.50, please check. If the problem still exists, please create a new issue at http://kotl.in/issue with your code example.