'Type parameter cannot have any other bounds if it's bounded by another type parameter: what does this mean and how to resolve it?

I was implementing custom list class MyList<T> in kotlin. In that, I wanted to add insertSorted function, which inserts a new element into the list in sorted order. For that, T must implement comparator. So the prototype of that function will be fun <C> insertSorted(ele: C) where C:T, C:Comparable<T> But this is giving me Type parameter cannot have any other bounds if it's bounded by another type parameter error. I am not understanding what this error is. Also, this question did not help me much.

PS: The type I am passing to that function is declared as class MyClass : Comparator<MyClass>. So the bound where C:T, C:Comparator<T> is valid I guess.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source