Strange error message for failing an Ordered[T]
type bound
#14363
Labels
Milestone
Ordered[T]
type bound
#14363
Compiler version
3.1.0
Minimized code
Output
Expectation
Info
Hello all, I accidentally came across this while reading Chapter 18 "Type Parameterization" of "Programming in Scala, 5th Edition". At the end of the chapter there is an example of
then the book demonstrates why this cannot be used to sort a list of integers because
Int
is not a subtype ofOrdered[Int]
:I thought the error message looked really strange, and obviously different from the book. So I minimized it.
Providing a type parameter gives a much better message:
Also doing one of the mentioned imports fixes the problem too.
Wasn't sure if it is a bug. I asked in Discussions, @SethTisue encouraged me to ask in Scala Users, where @smarter encouraged me to report it.
The text was updated successfully, but these errors were encountered: