zceejkr
10/28/2019, 11:47 AMcompanion object : SomeType = someFunc()
. Or do you always have to declare the companion, as in companion object : SomeType {body}
?devbridie
10/28/2019, 11:51 AMcompanion object { val thing = someFunc() }
is the closest you can getzceejkr
10/28/2019, 11:54 AMmarstran
10/28/2019, 11:57 AMcompanion object : SomeType by someFunc()
works?wbertan
10/28/2019, 11:57 AMtypealias SomeType = () -> String
fun someFunc(): String = "asas"
object Asas : SomeType by ::someFunc
class ExampleUnitTest {
@Test
fun asas() {
assertEquals("asas", Asas())
}
}
By the way, I didn’t tested 😆zceejkr
10/28/2019, 11:58 AMkarelpeeters
10/28/2019, 12:02 PM