Hullaballoonatic
05/15/2019, 6:19 PMBar
to be able to call foo()
and return its own typedalexander
05/15/2019, 6:20 PMfun foo(): T = ...
and Baz but that has its own set of problems it introduces.Hullaballoonatic
05/15/2019, 6:21 PMdalexander
05/15/2019, 6:23 PMHullaballoonatic
05/15/2019, 6:23 PMdalexander
05/15/2019, 6:25 PMJoe
05/15/2019, 6:28 PMabstract class Bar<T : Bar<T>> {
abstract fun subBar(): T
fun foo(): T = subBar()
}
class Baz : Bar<Baz>() {
override fun subBar(): Baz {
return this
}
}
val a: Baz = Baz()
val b: Baz = a.foo()
compiles at leastdalexander
05/15/2019, 6:30 PMBaz
has complications.Hullaballoonatic
05/15/2019, 6:32 PMdalexander
05/15/2019, 6:34 PMHullaballoonatic
05/15/2019, 6:34 PM