What specifically allows an inner type to be used ...
# general-advice
z
What specifically allows an inner type to be used for a property, but requires the outer name (or an import) as a generic type?
Copy code
data class ClassWithProp(
    val prop: Prop
) {
    interface Prop
}

data class ClassWithType<TProp : ClassWithType.Prop>(
    val prop: TProp
) {
    interface Prop
}
I'd like to be able to use the type in a generic constraint, without specifying the outer class, or importing
Copy code
data class ClassWithType<TProp : Prop>(
    val prop: TProp
) {
    interface Prop
}
Is it something like, the type is resolved(?) before the constructors, and before other things defined inside the type (members, functions, other types), but all types are resolved before constructors? • ClassWithType ◦ generic, depends on ClassWithType.Prop ▪︎ resolve ClassWithType.Prop first ◦ inner types ◦ constructors • ClassWithProps ◦ inner types ◦ constructors