How to define generic argument that extends nullable but not nullable itself
In Kotlin is there a way to define a non-nullable generic argument that is a subtype of nullable type?
I thought that I can do something like
class nullableToNonnullable where B: A, B: Any {
fun toNonNull(a: A): B
}
but I'm getting compile time error:
Type parameter cannot have any other bounds if it's bounded by another type parameter
Right now I can only work around it by using a wrapper type, something like Option
class nullableToNonnullable {
fun toNonNull(a: Option<A>): A
}