Get recursive "Type argument is not within its bounds" for recursive bounds when initializing an object
class RawType {
inner class BoundRecursively<T : BoundRecursively<T>?>
fun test() {
val boundRecursively = BoundRecursively<BoundRecursively<Any>?>()
}
}
the compiler gives error
Type argument is not within its bounds: should be subtype of 'RawType.BoundRecursively<TypeVariable(T)>?'
Type argument is not within its bounds: should be subtype of 'RawType.BoundRecursively<Any>?'
Type argument is not within its bounds: should be subtype of 'Any'
Type argument is not within its bounds: should be subtype of 'RawType.BoundRecursively<RawType.BoundRecursively<Any>?>?'
Type argument is not within its bounds: should be subtype of 'RawType.BoundRecursively<RawType.BoundRecursively<Any>?>?'
Type argument is not within its bounds: should be subtype of 'RawType.BoundRecursively<Any>?'
Any suggestion on how to fix the initialization