Hello - I’m trying to use a constructor reference ...
# codereview
d
Hello - I’m trying to use a constructor reference for an inner class, but getting an error:
Copy code
class OuterClass {
    // Error:(2, 45) Kotlin: Left-hand side of a callable reference with a receiver parameter cannot be empty. Please specify the type of the receiver before '::' explicitly
    val creator: (String) -> InnerClass = ::InnerClass
    inner class InnerClass(val name: String)
}
The constructor reference does work when the inner class is not marked as
inner
. I can also wrap the constructor in a lambda, but that seems like it should be unnecessary. Can someone explain the reason that I get the error?