ghedeon
12/19/2018, 9:07 PM:: (bound callable reference?). Any way to properly import Companion so I don't see it in the code?
class Foo(bar: () -> Bar)
class Bar {
companion object {
fun newInstance() = Bar()
}
}
....
Foo(Bar.Companion::newInstance) //<--- works
Foo(Bar::newInstance) //<--- doesn't workRuckus
12/19/2018, 10:03 PMBar::newInstance is a reference to a function on Bar.Ruckus
12/19/2018, 10:05 PMclass Bar {
companion object : () -> Bar {
override fun invoke() = Bar()
}
}
Foo(Bar)ghedeon
12/20/2018, 7:06 AM