mzgreen
11/22/2022, 7:40 PMclass Foo
fun Foo.test() {
println("hello")
}
val x = Foo::test
x(Foo())
doesn’t work in an IntelliJ/AndroidStudio Kotlin scratch file? It shows: “‘test’ is a member and an extension at the same time. References to such elements are not allowed” error. But it works in Kotlin playground: https://pl.kotl.in/ubsrNwrCx ? Is this a bug?ephemient
11/22/2022, 7:44 PMephemient
11/22/2022, 7:46 PMobject {
class Foo
fun Foo.test()
}
and because test
is a member of the wrapper and a extension of Foo
, you get that errorephemient
11/22/2022, 7:48 PMmzgreen
11/22/2022, 7:50 PMEmil Kantis
11/22/2022, 7:59 PMephemient
11/22/2022, 8:26 PMproject
etc. to *.gradle.kts
scripts) which is an important use-case for Kotlin scripting, even if it's not what you want in the simple REPL and scratch file case