class Outer<T> {
inner class Inner
}
class Host<T> {
typealias Problem = Outer<T>.Inner
}
Here type alias Problem
captures a type parameter T
from Host
.
Consider type alias constructor for Problem
. It captures type parameter T
from Host
and has a receiver of type Outer<T>
. This is impossible in the resolution algorithm used in Kotlin 1.0 and 1.1, and is tightly intervened with the design for specialized generics, which is in a rather early stage (and is required for Kotlin Native and Java 10 interoperability; google “species static” if you are curious).
There are also some problems with type aliases inheritance (that currently makes type aliases in interfaces not quite useful).
If we support them now “with some limitations”, it turns out we can’t remove those limitations later, because it would be a breaking change in the resolution scheme (which is a big no-no).
So, we decided to wait until we have a more or less stable design for new resolution scheme that would be able to support such declarations.
We do consider nested type aliases useful, and they are still in the plans, but not for 1.1.